@@ -259,7 +259,6 @@ func TestUpdateUserProfile(t *testing.T) {
259
259
coderdtest .CreateFirstUser (t , client )
260
260
_ , err := client .UpdateUserProfile (context .Background (), uuid .New ().String (), codersdk.UpdateUserProfileRequest {
261
261
Username : "newusername" ,
262
- Email : "newemail@coder.com" ,
263
262
})
264
263
var apiErr * codersdk.Error
265
264
require .ErrorAs (t , err , & apiErr )
@@ -268,25 +267,6 @@ func TestUpdateUserProfile(t *testing.T) {
268
267
require .Equal (t , http .StatusBadRequest , apiErr .StatusCode ())
269
268
})
270
269
271
- t .Run ("ConflictingEmail" , func (t * testing.T ) {
272
- t .Parallel ()
273
- client := coderdtest .New (t , nil )
274
- user := coderdtest .CreateFirstUser (t , client )
275
- existentUser , _ := client .CreateUser (context .Background (), codersdk.CreateUserRequest {
276
- Email : "bruno@coder.com" ,
277
- Username : "bruno" ,
278
- Password : "password" ,
279
- OrganizationID : user .OrganizationID ,
280
- })
281
- _ , err := client .UpdateUserProfile (context .Background (), codersdk .Me , codersdk.UpdateUserProfileRequest {
282
- Username : "newusername" ,
283
- Email : existentUser .Email ,
284
- })
285
- var apiErr * codersdk.Error
286
- require .ErrorAs (t , err , & apiErr )
287
- require .Equal (t , http .StatusConflict , apiErr .StatusCode ())
288
- })
289
-
290
270
t .Run ("ConflictingUsername" , func (t * testing.T ) {
291
271
t .Parallel ()
292
272
client := coderdtest .New (t , nil )
@@ -300,38 +280,22 @@ func TestUpdateUserProfile(t *testing.T) {
300
280
require .NoError (t , err )
301
281
_ , err = client .UpdateUserProfile (context .Background (), codersdk .Me , codersdk.UpdateUserProfileRequest {
302
282
Username : existentUser .Username ,
303
- Email : "newemail@coder.com" ,
304
283
})
305
284
var apiErr * codersdk.Error
306
285
require .ErrorAs (t , err , & apiErr )
307
286
require .Equal (t , http .StatusConflict , apiErr .StatusCode ())
308
287
})
309
288
310
- t .Run ("UpdateUsernameAndEmail " , func (t * testing.T ) {
289
+ t .Run ("UpdateUsername " , func (t * testing.T ) {
311
290
t .Parallel ()
312
291
client := coderdtest .New (t , nil )
313
292
coderdtest .CreateFirstUser (t , client )
293
+ _ , _ = client .User (context .Background (), codersdk .Me )
314
294
userProfile , err := client .UpdateUserProfile (context .Background (), codersdk .Me , codersdk.UpdateUserProfileRequest {
315
295
Username : "newusername" ,
316
- Email : "newemail@coder.com" ,
317
296
})
318
297
require .NoError (t , err )
319
298
require .Equal (t , userProfile .Username , "newusername" )
320
- require .Equal (t , userProfile .Email , "newemail@coder.com" )
321
- })
322
-
323
- t .Run ("UpdateUsername" , func (t * testing.T ) {
324
- t .Parallel ()
325
- client := coderdtest .New (t , nil )
326
- coderdtest .CreateFirstUser (t , client )
327
- me , _ := client .User (context .Background (), codersdk .Me )
328
- userProfile , err := client .UpdateUserProfile (context .Background (), codersdk .Me , codersdk.UpdateUserProfileRequest {
329
- Username : me .Username ,
330
- Email : "newemail@coder.com" ,
331
- })
332
- require .NoError (t , err )
333
- require .Equal (t , userProfile .Username , me .Username )
334
- require .Equal (t , userProfile .Email , "newemail@coder.com" )
335
299
})
336
300
}
337
301
0 commit comments