9
9
10
10
"github.com/coder/coder/v2/cli/clitest"
11
11
"github.com/coder/coder/v2/coderd/coderdtest"
12
+ "github.com/coder/coder/v2/coderd/rbac"
12
13
"github.com/coder/coder/v2/codersdk"
13
14
)
14
15
@@ -36,12 +37,13 @@ func TestUserStatus(t *testing.T) {
36
37
37
38
client := coderdtest .New (t , nil )
38
39
admin := coderdtest .CreateFirstUser (t , client )
40
+ userAdmin , _ := coderdtest .CreateAnotherUser (t , client , admin .OrganizationID , rbac .RoleUserAdmin ())
39
41
other , _ := coderdtest .CreateAnotherUser (t , client , admin .OrganizationID )
40
42
otherUser , err := other .User (context .Background (), codersdk .Me )
41
43
require .NoError (t , err , "fetch user" )
42
44
43
45
inv , root := clitest .New (t , "users" , "suspend" , otherUser .Username )
44
- clitest .SetupConfig (t , client , root )
46
+ clitest .SetupConfig (t , userAdmin , root )
45
47
// Yes to the prompt
46
48
inv .Stdin = bytes .NewReader ([]byte ("yes\n " ))
47
49
err = inv .Run ()
@@ -54,7 +56,7 @@ func TestUserStatus(t *testing.T) {
54
56
55
57
// Set back to active. Try using a uuid as well
56
58
inv , root = clitest .New (t , "users" , "activate" , otherUser .ID .String ())
57
- clitest .SetupConfig (t , client , root )
59
+ clitest .SetupConfig (t , userAdmin , root )
58
60
// Yes to the prompt
59
61
inv .Stdin = bytes .NewReader ([]byte ("yes\n " ))
60
62
err = inv .Run ()
0 commit comments