Skip to content

Commit 23a8191

Browse files
committed
Fix unit test
1 parent 6989e13 commit 23a8191

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

coderd/users_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,17 +530,22 @@ func TestGetUsers(t *testing.T) {
530530
})
531531
t.Run("ActiveUsers", func(t *testing.T) {
532532
t.Parallel()
533+
active := make([]codersdk.User, 0)
533534
client := coderdtest.New(t, nil)
534535
first := coderdtest.CreateFirstUser(t, client)
535-
active := make([]codersdk.User, 0)
536+
537+
firstUser, err := client.User(context.Background(), first.UserID)
538+
require.NoError(t, err, "")
539+
active = append(active, firstUser)
540+
541+
// Alice will be suspended
536542
alice, err := client.CreateUser(context.Background(), codersdk.CreateUserRequest{
537543
Email: "alice@email.com",
538544
Username: "alice",
539545
Password: "password",
540546
OrganizationID: first.OrganizationID,
541547
})
542548
require.NoError(t, err)
543-
active = append(active, alice)
544549

545550
bruno, err := client.CreateUser(context.Background(), codersdk.CreateUserRequest{
546551
Email: "bruno@email.com",
@@ -551,7 +556,7 @@ func TestGetUsers(t *testing.T) {
551556
require.NoError(t, err)
552557
active = append(active, bruno)
553558

554-
_, err = client.SetUserStatus(context.Background(), first.UserID, codersdk.UserStatusSuspended)
559+
_, err = client.SetUserStatus(context.Background(), alice.ID, codersdk.UserStatusSuspended)
555560
require.NoError(t, err)
556561

557562
users, err := client.Users(context.Background(), codersdk.UsersRequest{

0 commit comments

Comments
 (0)