@@ -737,21 +737,28 @@ func TestInitialRoles(t *testing.T) {
737
737
func TestPutUserSuspend (t * testing.T ) {
738
738
t .Parallel ()
739
739
740
+ t .Run ("SuspendAnOwner" , func (t * testing.T ) {
741
+ t .Parallel ()
742
+ client := coderdtest .New (t , nil )
743
+ me := coderdtest .CreateFirstUser (t , client )
744
+ _ , user := coderdtest .CreateAnotherUserWithUser (t , client , me .OrganizationID , rbac .RoleOwner ())
745
+
746
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
747
+ defer cancel ()
748
+
749
+ _ , err := client .UpdateUserStatus (ctx , user .Username , codersdk .UserStatusSuspended )
750
+ require .Error (t , err , "cannot suspend owners" )
751
+ })
752
+
740
753
t .Run ("SuspendAnotherUser" , func (t * testing.T ) {
741
754
t .Parallel ()
742
755
client := coderdtest .New (t , nil )
743
756
me := coderdtest .CreateFirstUser (t , client )
757
+ _ , user := coderdtest .CreateAnotherUserWithUser (t , client , me .OrganizationID )
744
758
745
759
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
746
760
defer cancel ()
747
761
748
- client .User (ctx , codersdk .Me )
749
- user , _ := client .CreateUser (ctx , codersdk.CreateUserRequest {
750
- Email : "bruno@coder.com" ,
751
- Username : "bruno" ,
752
- Password : "password" ,
753
- OrganizationID : me .OrganizationID ,
754
- })
755
762
user , err := client .UpdateUserStatus (ctx , user .Username , codersdk .UserStatusSuspended )
756
763
require .NoError (t , err )
757
764
require .Equal (t , user .Status , codersdk .UserStatusSuspended )
@@ -841,7 +848,7 @@ func TestUsersFilter(t *testing.T) {
841
848
for i := 0 ; i < 15 ; i ++ {
842
849
roles := []string {}
843
850
if i % 2 == 0 {
844
- roles = append (roles , rbac .RoleOwner ())
851
+ roles = append (roles , rbac .RoleTemplateAdmin (), rbac . RoleUserAdmin ())
845
852
}
846
853
if i % 3 == 0 {
847
854
roles = append (roles , "auditor" )
0 commit comments