@@ -489,13 +489,16 @@ func TestNotifyDeletedUser(t *testing.T) {
489
489
adminClient := coderdtest .New (t , & coderdtest.Options {
490
490
NotificationsEnqueuer : notifyEnq ,
491
491
})
492
- firstUser := coderdtest .CreateFirstUser (t , adminClient )
492
+ firstUserResponse := coderdtest .CreateFirstUser (t , adminClient )
493
493
494
494
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
495
495
defer cancel ()
496
496
497
+ firstUser , err := adminClient .User (ctx , firstUserResponse .UserID .String ())
498
+ require .NoError (t , err )
499
+
497
500
user , err := adminClient .CreateUserWithOrgs (ctx , codersdk.CreateUserRequestWithOrgs {
498
- OrganizationIDs : []uuid.UUID {firstUser .OrganizationID },
501
+ OrganizationIDs : []uuid.UUID {firstUserResponse .OrganizationID },
499
502
Email : "another@user.org" ,
500
503
Username : "someone-else" ,
501
504
Password : "SomeSecurePassword!" ,
@@ -510,12 +513,11 @@ func TestNotifyDeletedUser(t *testing.T) {
510
513
require .Len (t , notifyEnq .Sent , 2 )
511
514
// notifyEnq.Sent[0] is create account event
512
515
require .Equal (t , notifications .TemplateUserAccountDeleted , notifyEnq .Sent [1 ].TemplateID )
513
- require .Equal (t , firstUser .UserID , notifyEnq .Sent [1 ].UserID )
516
+ require .Equal (t , firstUser .ID , notifyEnq .Sent [1 ].UserID )
514
517
require .Contains (t , notifyEnq .Sent [1 ].Targets , user .ID )
515
518
require .Equal (t , user .Username , notifyEnq .Sent [1 ].Labels ["deleted_account_name" ])
516
519
require .Equal (t , user .Name , notifyEnq .Sent [1 ].Labels ["deleted_account_user_name" ])
517
- // Not sure where to get the following just yet
518
- // require.Equal(t, , notifyEnq.Sent[1].Labels["account_deleter_user_name"])
520
+ require .Equal (t , firstUser .Name , notifyEnq .Sent [1 ].Labels ["account_deleter_user_name" ])
519
521
})
520
522
521
523
t .Run ("UserAdminNotified" , func (t * testing.T ) {
0 commit comments