@@ -1839,6 +1839,44 @@ osu file format v14
18391839 }
18401840 }
18411841
1842+ [ Fact ]
1843+ public async Task TestPatch_BeatmapWithNoChanges_BumpsLastUpdateDate ( )
1844+ {
1845+ using var db = await DatabaseAccess . GetConnectionAsync ( ) ;
1846+ await db . ExecuteAsync (
1847+ "INSERT INTO `phpbb_users` (`user_id`, `username`, `username_clean`, `country_acronym`, `user_permissions`, `user_sig`, `user_occ`, `user_interests`) VALUES (1000, 'test', 'test', 'JP', '', '', '', '')" ) ;
1848+
1849+ await db . ExecuteAsync (
1850+ @"INSERT INTO `osu_beatmapsets` (`beatmapset_id`, `user_id`, `creator`, `approved`, `thread_id`, `active`, `submit_date`) VALUES (241526, 1000, 'test user', -1, 0, -1, CURRENT_TIMESTAMP)" ) ;
1851+
1852+ foreach ( uint beatmapId in new uint [ ] { 557815 , 557814 , 557821 , 557816 , 557817 , 557818 , 557812 , 557810 , 557811 , 557820 , 557813 , 557819 } )
1853+ await db . ExecuteAsync ( @"INSERT INTO `osu_beatmaps` (`beatmap_id`, `user_id`, `beatmapset_id`, `approved`) VALUES (@beatmapId, 1000, 241526, -1)" , new { beatmapId = beatmapId } ) ;
1854+
1855+ // do a full upload first - required to correctly populate versioning tables
1856+ var putRequest = new HttpRequestMessage ( HttpMethod . Put , "/beatmapsets/241526" ) ;
1857+
1858+ using var content = new MultipartFormDataContent ( $ "{ Guid . NewGuid ( ) } ----") ;
1859+ using var stream = TestResources . GetResource ( osz_filename ) ! ;
1860+ content . Add ( new StreamContent ( stream ) , "beatmapArchive" , osz_filename ) ;
1861+ putRequest . Content = content ;
1862+ putRequest . Headers . Add ( HeaderBasedAuthenticationHandler . USER_ID_HEADER , "1000" ) ;
1863+
1864+ var putResponse = await Client . SendAsync ( putRequest ) ;
1865+ Assert . True ( putResponse . IsSuccessStatusCode ) ;
1866+
1867+ // manually doctor the beatmapset's last update date to make sure it's bumped on a no-op patch
1868+ await db . ExecuteAsync ( @"UPDATE `osu_beatmapsets` SET `last_update` = '2020-01-01 00:00:00' WHERE `beatmapset_id` = 241526" ) ;
1869+
1870+ // perform a no-op patch
1871+ var patchRequest = new HttpRequestMessage ( HttpMethod . Patch , "/beatmapsets/241526" ) ;
1872+ patchRequest . Headers . Add ( HeaderBasedAuthenticationHandler . USER_ID_HEADER , "1000" ) ;
1873+
1874+ var response = await Client . SendAsync ( patchRequest ) ;
1875+ Assert . True ( response . IsSuccessStatusCode ) ;
1876+
1877+ WaitForDatabaseState ( @"SELECT COUNT(1) FROM `osu_beatmapsets` WHERE `beatmapset_id` = 241526 AND `last_update` > '2020-01-01 00:00:00'" , 1 , CancellationToken ) ;
1878+ }
1879+
18421880 [ Fact ]
18431881 public async Task TestSubmitGuestDifficulty_OldStyle ( )
18441882 {
0 commit comments