summaryrefslogtreecommitdiffstats
path: root/api/command_test.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-01-11 09:39:09 -0600
committer=Corey Hulen <corey@hulen.com>2016-01-11 09:39:09 -0600
commit2bf43e79582c2e8ca50caa29d7457716112b4796 (patch)
tree8661082b6b5cb1673d3109241859e97a6cbc0cdf /api/command_test.go
parenta70d5504091b93773e3cc0290be32ae51660bf30 (diff)
downloadchat-2bf43e79582c2e8ca50caa29d7457716112b4796.tar.gz
chat-2bf43e79582c2e8ca50caa29d7457716112b4796.tar.bz2
chat-2bf43e79582c2e8ca50caa29d7457716112b4796.zip
Switching to enable integrations for testing
Diffstat (limited to 'api/command_test.go')
-rw-r--r--api/command_test.go25
1 files changed, 17 insertions, 8 deletions
diff --git a/api/command_test.go b/api/command_test.go
index 8243b0ddf..e5e954170 100644
--- a/api/command_test.go
+++ b/api/command_test.go
@@ -43,6 +43,11 @@ func TestListCommands(t *testing.T) {
func TestCreateCommand(t *testing.T) {
Setup()
+
+ enableCommands := *utils.Cfg.ServiceSettings.EnableCommands
+ defer func() {
+ utils.Cfg.ServiceSettings.EnableCommands = &enableCommands
+ }()
*utils.Cfg.ServiceSettings.EnableCommands = true
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
@@ -92,12 +97,14 @@ func TestCreateCommand(t *testing.T) {
t.Fatal("bad team id wasn't overwritten")
}
}
-
- *utils.Cfg.ServiceSettings.EnableCommands = false
}
func TestListTeamCommands(t *testing.T) {
Setup()
+ enableCommands := *utils.Cfg.ServiceSettings.EnableCommands
+ defer func() {
+ utils.Cfg.ServiceSettings.EnableCommands = &enableCommands
+ }()
*utils.Cfg.ServiceSettings.EnableCommands = true
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
@@ -125,12 +132,14 @@ func TestListTeamCommands(t *testing.T) {
t.Fatal("incorrect number of cmd")
}
}
-
- *utils.Cfg.ServiceSettings.EnableCommands = false
}
func TestRegenToken(t *testing.T) {
Setup()
+ enableCommands := *utils.Cfg.ServiceSettings.EnableCommands
+ defer func() {
+ utils.Cfg.ServiceSettings.EnableCommands = &enableCommands
+ }()
*utils.Cfg.ServiceSettings.EnableCommands = true
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
@@ -159,12 +168,14 @@ func TestRegenToken(t *testing.T) {
t.Fatal("regen didn't work properly")
}
}
-
- *utils.Cfg.ServiceSettings.EnableCommands = false
}
func TestDeleteCommand(t *testing.T) {
Setup()
+ enableCommands := *utils.Cfg.ServiceSettings.EnableCommands
+ defer func() {
+ utils.Cfg.ServiceSettings.EnableCommands = &enableCommands
+ }()
*utils.Cfg.ServiceSettings.EnableCommands = true
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
@@ -194,6 +205,4 @@ func TestDeleteCommand(t *testing.T) {
if len(cmds) != 0 {
t.Fatal("delete didn't work properly")
}
-
- *utils.Cfg.ServiceSettings.EnableCommands = false
}