@@ -20,6 +20,7 @@ public async Task ResetsUsersPasswordByUuidAndName()
2020 GameUser mod = context . CreateUser ( role : GameUserRole . Moderator ) ;
2121 HttpClient client = context . GetAuthenticatedClient ( TokenType . Api , mod ) ;
2222
23+ // UUID
2324 GameUser player1 = context . CreateUser ( role : GameUserRole . User ) ;
2425 ApiResetPasswordRequest request = new ( )
2526 {
@@ -33,31 +34,19 @@ public async Task ResetsUsersPasswordByUuidAndName()
3334 Assert . That ( updated1 , Is . Not . Null ) ;
3435 Assert . That ( updated1 ! . ShouldResetPassword , Is . True ) ;
3536
37+ // Name
3638 GameUser player2 = context . CreateUser ( role : GameUserRole . User ) ;
3739 request = new ( )
3840 {
3941 PasswordSha512 = HexHelper . BytesToHexString ( SHA512 . HashData ( "poo"u8 ) )
4042 } ;
41- response = await client . PutAsync ( $ "/api/v3/admin/users/uuid /{ player2 . UserId } /resetPassword", new StringContent ( request . AsJson ( ) ) ) ;
43+ response = await client . PutAsync ( $ "/api/v3/admin/users/name /{ player2 . Username } /resetPassword", new StringContent ( request . AsJson ( ) ) ) ;
4244 Assert . That ( response . IsSuccessStatusCode , Is . True ) ;
4345
4446 context . Database . Refresh ( ) ;
4547 GameUser ? updated2 = context . Database . GetUserByObjectId ( player2 . UserId ) ;
4648 Assert . That ( updated2 , Is . Not . Null ) ;
4749 Assert . That ( updated2 ! . ShouldResetPassword , Is . True ) ;
48-
49- GameUser player3 = context . CreateUser ( role : GameUserRole . User ) ;
50- request = new ( )
51- {
52- PasswordSha512 = HexHelper . BytesToHexString ( SHA512 . HashData ( "poo"u8 ) )
53- } ;
54- response = await client . PutAsync ( $ "/api/v3/admin/users/uuid/{ player3 . UserId } /resetPassword", new StringContent ( request . AsJson ( ) ) ) ;
55- Assert . That ( response . IsSuccessStatusCode , Is . True ) ;
56-
57- context . Database . Refresh ( ) ;
58- GameUser ? updated3 = context . Database . GetUserByObjectId ( player3 . UserId ) ;
59- Assert . That ( updated3 , Is . Not . Null ) ;
60- Assert . That ( updated3 ! . ShouldResetPassword , Is . True ) ;
6150 }
6251
6352 [ Test ]
@@ -107,26 +96,5 @@ public async Task GetsAndResetsUserPlanetsByUuidAndName()
10796 updated = context . Database . GetUserByObjectId ( updated . UserId ) ;
10897 Assert . That ( updated , Is . Not . Null ) ;
10998 Assert . That ( updated ! . Lbp3PlanetsHash . IsBlankHash ( ) , Is . True ) ;
110-
111- // username
112- context . Database . UpdateUserData ( updated , new SerializedUpdateData ( )
113- {
114- PlanetsHash = "lol"
115- } , TokenGame . LittleBigPlanetVita ) ;
116-
117- context . Database . Refresh ( ) ;
118-
119- planetResponse = client . GetData < ApiAdminUserPlanetsResponse > ( $ "/api/v3/admin/users/username/{ updated . Username } /planets") ;
120- Assert . That ( planetResponse ? . Data , Is . Not . Null ) ;
121- Assert . That ( planetResponse ! . Data ! . VitaPlanetsHash , Is . EqualTo ( "lol" ) ) ;
122-
123- resetResponse = await client . DeleteAsync ( $ "/api/v3/admin/users/username/{ updated . Username } /planets") ;
124- Assert . That ( resetResponse . IsSuccessStatusCode , Is . True ) ;
125-
126- context . Database . Refresh ( ) ;
127-
128- updated = context . Database . GetUserByObjectId ( updated . UserId ) ;
129- Assert . That ( updated , Is . Not . Null ) ;
130- Assert . That ( updated ! . VitaPlanetsHash . IsBlankHash ( ) , Is . True ) ;
13199 }
132100}
0 commit comments