diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2018-04-30 17:57:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 17:57:57 +0800 |
commit | 30011f67e88935f750bced6530e8ee92b352b7a3 (patch) | |
tree | b4ec005faa0f11927669499a030c851efa15723b /api4/team_test.go | |
parent | 2e6b3da1d3466db379fef0d61a23e2878d17ee9d (diff) | |
download | chat-30011f67e88935f750bced6530e8ee92b352b7a3.tar.gz chat-30011f67e88935f750bced6530e8ee92b352b7a3.tar.bz2 chat-30011f67e88935f750bced6530e8ee92b352b7a3.zip |
[MM-10354] Add feature to remove team icon (#8684)
* set team.LastTeamIconUpdate to 0 when removing team icon
* add APIv4 for removing team icon
* removed comment and updated typo on AppError
Diffstat (limited to 'api4/team_test.go')
-rw-r--r-- | api4/team_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/api4/team_test.go b/api4/team_test.go index cdf201771..705ff603b 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) +} |