Skip to content

Commit 8f1ef7b

Browse files
committed
Fix
1 parent 4997479 commit 8f1ef7b

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

cli/userstatus_test.go

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ import (
1414

1515
func TestUserStatus(t *testing.T) {
1616
t.Parallel()
17-
client := coderdtest.New(t, nil)
18-
admin := coderdtest.CreateFirstUser(t, client)
19-
other, _ := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID)
20-
otherUser, err := other.User(context.Background(), codersdk.Me)
21-
require.NoError(t, err, "fetch user")
2217

2318
t.Run("StatusSelf", func(t *testing.T) {
2419
t.Parallel()
20+
21+
client := coderdtest.New(t, nil)
22+
coderdtest.CreateFirstUser(t, client)
23+
2524
inv, root := clitest.New(t, "users", "suspend", "me")
2625
clitest.SetupConfig(t, client, root)
2726
// Yes to the prompt
@@ -34,13 +33,18 @@ func TestUserStatus(t *testing.T) {
3433

3534
t.Run("StatusOther", func(t *testing.T) {
3635
t.Parallel()
37-
require.Equal(t, codersdk.UserStatusActive, otherUser.Status, "start as active")
36+
37+
client := coderdtest.New(t, nil)
38+
admin := coderdtest.CreateFirstUser(t, client)
39+
other, _ := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID)
40+
otherUser, err := other.User(context.Background(), codersdk.Me)
41+
require.NoError(t, err, "fetch user")
3842

3943
inv, root := clitest.New(t, "users", "suspend", otherUser.Username)
4044
clitest.SetupConfig(t, client, root)
4145
// Yes to the prompt
4246
inv.Stdin = bytes.NewReader([]byte("yes\n"))
43-
err := inv.Run()
47+
err = inv.Run()
4448
require.NoError(t, err, "suspend user")
4549

4650
// Check the user status
@@ -64,13 +68,18 @@ func TestUserStatus(t *testing.T) {
6468

6569
t.Run("StatusDormant", func(t *testing.T) {
6670
t.Parallel()
67-
require.Equal(t, codersdk.UserStatusActive, otherUser.Status, "start as active")
71+
72+
client := coderdtest.New(t, nil)
73+
admin := coderdtest.CreateFirstUser(t, client)
74+
other, _ := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID)
75+
otherUser, err := other.User(context.Background(), codersdk.Me)
76+
require.NoError(t, err, "fetch user")
6877

6978
inv, root := clitest.New(t, "users", "dormant", otherUser.Username)
7079
clitest.SetupConfig(t, client, root)
7180
// Yes to the prompt
7281
inv.Stdin = bytes.NewReader([]byte("yes\n"))
73-
err := inv.Run()
82+
err = inv.Run()
7483
require.NoError(t, err, "mark as dormant")
7584

7685
// Check the user status

0 commit comments

Comments
 (0)