summaryrefslogtreecommitdiffstats
path: root/api4/team_test.go
diff options
context:
space:
mode:
authorMartin Kraft <martinkraft@gmail.com>2018-05-01 18:59:20 -0400
committerMartin Kraft <martinkraft@gmail.com>2018-05-01 18:59:20 -0400
commitff6c42309c4dd328b5841cfeef6b59ea59a4379c (patch)
treec2c3b4938588549ea69653a46d98b27f6fe37b80 /api4/team_test.go
parent2386acb3ddabd8827e21b1862c338a8b13a25de6 (diff)
parente73f1d73143ebba9c7e80d21c45bba9b61f2611c (diff)
downloadchat-ff6c42309c4dd328b5841cfeef6b59ea59a4379c.tar.gz
chat-ff6c42309c4dd328b5841cfeef6b59ea59a4379c.tar.bz2
chat-ff6c42309c4dd328b5841cfeef6b59ea59a4379c.zip
Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Diffstat (limited to 'api4/team_test.go')
-rw-r--r--api4/team_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/api4/team_test.go b/api4/team_test.go
index 3cd9d7d93..6540457b0 100644
--- a/api4/team_test.go
+++ b/api4/team_test.go
@@ -2015,3 +2015,40 @@ func TestGetTeamIcon(t *testing.T) {
_, resp = Client.GetTeamIcon(team.Id, "")
CheckUnauthorizedStatus(t, resp)
}
+
+func TestRemoveTeamIcon(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer th.TearDown()
+ Client := th.Client
+ team := th.BasicTeam
+
+ th.LoginTeamAdmin()
+ data, _ := readTestFile("test.png")
+ Client.SetTeamIcon(team.Id, data)
+
+ _, resp := Client.RemoveTeamIcon(team.Id)
+ CheckNoError(t, resp)
+ teamAfter, _ := th.App.GetTeam(team.Id)
+ if teamAfter.LastTeamIconUpdate != 0 {
+ t.Fatal("should update LastTeamIconUpdate to 0")
+ }
+
+ Client.SetTeamIcon(team.Id, data)
+
+ _, resp = th.SystemAdminClient.RemoveTeamIcon(team.Id)
+ CheckNoError(t, resp)
+ teamAfter, _ = th.App.GetTeam(team.Id)
+ if teamAfter.LastTeamIconUpdate != 0 {
+ t.Fatal("should update LastTeamIconUpdate to 0")
+ }
+
+ Client.SetTeamIcon(team.Id, data)
+ Client.Logout()
+
+ _, resp = Client.RemoveTeamIcon(team.Id)
+ CheckUnauthorizedStatus(t, resp)
+
+ th.LoginBasic()
+ _, resp = Client.RemoveTeamIcon(team.Id)
+ CheckForbiddenStatus(t, resp)
+}