summaryrefslogtreecommitdiffstats
path: root/api4/user_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'api4/user_test.go')
-rw-r--r--api4/user_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/api4/user_test.go b/api4/user_test.go
index 082b48dd6..40f6b4117 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -219,6 +219,37 @@ func TestUpdateUser(t *testing.T) {
CheckNoError(t, resp)
}
+func TestDeleteUser(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ Client := th.Client
+
+ user := th.BasicUser
+ th.LoginBasic()
+
+ testUser := th.SystemAdminUser
+ _, resp := Client.DeleteUser(testUser.Id)
+ CheckForbiddenStatus(t, resp)
+
+ Client.Logout()
+
+ _, resp = Client.DeleteUser(user.Id)
+ CheckUnauthorizedStatus(t, resp)
+
+ Client.Login(testUser.Email, testUser.Password)
+
+ user.Id = model.NewId()
+ _, resp = Client.DeleteUser(user.Id)
+ CheckNotFoundStatus(t, resp)
+
+ user.Id = "junk"
+ _, resp = Client.DeleteUser(user.Id)
+ CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.DeleteUser(testUser.Id)
+ CheckNoError(t, resp)
+
+}
+
func TestUpdateUserRoles(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
Client := th.Client