summaryrefslogtreecommitdiffstats
path: root/app/team_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-07-31 08:52:45 -0700
committerHarrison Healey <harrisonmhealey@gmail.com>2017-07-31 11:52:45 -0400
commit72f61ab96aabf65c162c8d94b5b843b5108ee1a9 (patch)
treec80d7158613663a0b3f584a1736ef1cbff72d160 /app/team_test.go
parent0f786a42d3289df9b4f5bdb4bddb0ecb07631608 (diff)
downloadchat-72f61ab96aabf65c162c8d94b5b843b5108ee1a9.tar.gz
chat-72f61ab96aabf65c162c8d94b5b843b5108ee1a9.tar.bz2
chat-72f61ab96aabf65c162c8d94b5b843b5108ee1a9.zip
make cli team / channel delete operations also delete webhooks and slash commands (#7028)
Diffstat (limited to 'app/team_test.go')
-rw-r--r--app/team_test.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/app/team_test.go b/app/team_test.go
index f2356d562..a410d6652 100644
--- a/app/team_test.go
+++ b/app/team_test.go
@@ -112,3 +112,44 @@ func TestAddUserToTeamByTeamId(t *testing.T) {
t.Fatal("Should add user to the team")
}
}
+
+func TestPermanentDeleteTeam(t *testing.T) {
+ th := Setup().InitBasic()
+
+ team, err := CreateTeam(&model.Team{
+ DisplayName: "deletion-test",
+ Name: "deletion-test",
+ Email: "foo@foo.com",
+ Type: model.TEAM_OPEN,
+ })
+ if err != nil {
+ t.Fatal(err.Error())
+ }
+ defer func() {
+ PermanentDeleteTeam(team)
+ }()
+
+ command, err := CreateCommand(&model.Command{
+ CreatorId: th.BasicUser.Id,
+ TeamId: team.Id,
+ Trigger: "foo",
+ URL: "http://foo",
+ Method: model.COMMAND_METHOD_POST,
+ })
+ if err != nil {
+ t.Fatal(err.Error())
+ }
+ defer DeleteCommand(command.Id)
+
+ if command, err = GetCommand(command.Id); command == nil || err != nil {
+ t.Fatal("unable to get new command")
+ }
+
+ if err := PermanentDeleteTeam(team); err != nil {
+ t.Fatal(err.Error())
+ }
+
+ if command, err = GetCommand(command.Id); command != nil || err == nil {
+ t.Fatal("command wasn't deleted")
+ }
+}