@@ -14,14 +14,13 @@ import (
14
14
15
15
func TestUserStatus (t * testing.T ) {
16
16
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" )
22
17
23
18
t .Run ("StatusSelf" , func (t * testing.T ) {
24
19
t .Parallel ()
20
+
21
+ client := coderdtest .New (t , nil )
22
+ coderdtest .CreateFirstUser (t , client )
23
+
25
24
inv , root := clitest .New (t , "users" , "suspend" , "me" )
26
25
clitest .SetupConfig (t , client , root )
27
26
// Yes to the prompt
@@ -34,13 +33,18 @@ func TestUserStatus(t *testing.T) {
34
33
35
34
t .Run ("StatusOther" , func (t * testing.T ) {
36
35
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" )
38
42
39
43
inv , root := clitest .New (t , "users" , "suspend" , otherUser .Username )
40
44
clitest .SetupConfig (t , client , root )
41
45
// Yes to the prompt
42
46
inv .Stdin = bytes .NewReader ([]byte ("yes\n " ))
43
- err : = inv .Run ()
47
+ err = inv .Run ()
44
48
require .NoError (t , err , "suspend user" )
45
49
46
50
// Check the user status
@@ -64,13 +68,18 @@ func TestUserStatus(t *testing.T) {
64
68
65
69
t .Run ("StatusDormant" , func (t * testing.T ) {
66
70
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" )
68
77
69
78
inv , root := clitest .New (t , "users" , "dormant" , otherUser .Username )
70
79
clitest .SetupConfig (t , client , root )
71
80
// Yes to the prompt
72
81
inv .Stdin = bytes .NewReader ([]byte ("yes\n " ))
73
- err : = inv .Run ()
82
+ err = inv .Run ()
74
83
require .NoError (t , err , "mark as dormant" )
75
84
76
85
// Check the user status
0 commit comments