summaryrefslogtreecommitdiffstats
path: root/api4/webhook_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-10-02 03:50:56 -0500
committerGeorge Goldberg <george@gberg.me>2017-10-02 09:50:56 +0100
commit9bc7af0c5704bbf73f8240b4569d5ea215352e39 (patch)
treeb17ddafc83ab43ccdce2116e83358299a08a50a6 /api4/webhook_test.go
parentb84736e9b6401df0c6eeab9950bef09458a6aefd (diff)
downloadchat-9bc7af0c5704bbf73f8240b4569d5ea215352e39.tar.gz
chat-9bc7af0c5704bbf73f8240b4569d5ea215352e39.tar.bz2
chat-9bc7af0c5704bbf73f8240b4569d5ea215352e39.zip
Don't use global app for api / api4 tests (#7528)
* don't use global app for api / api4 tests * put sleep back. we're gonna have to do some goroutine wrangling * fix oauth test config assumptions * jobs package, i'm comin' for you next * app test fix * try increasing sleep a little
Diffstat (limited to 'api4/webhook_test.go')
-rw-r--r--api4/webhook_test.go32
1 files changed, 17 insertions, 15 deletions
diff --git a/api4/webhook_test.go b/api4/webhook_test.go
index f85761026..b09f4411e 100644
--- a/api4/webhook_test.go
+++ b/api4/webhook_test.go
@@ -16,7 +16,7 @@ import (
func TestCreateIncomingWebhook(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.Client
enableIncomingHooks := utils.Cfg.ServiceSettings.EnableIncomingWebhooks
@@ -73,7 +73,7 @@ func TestCreateIncomingWebhook(t *testing.T) {
func TestGetIncomingWebhooks(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.Client
enableIncomingHooks := utils.Cfg.ServiceSettings.EnableIncomingWebhooks
@@ -155,7 +155,7 @@ func TestGetIncomingWebhooks(t *testing.T) {
func TestGetIncomingWebhook(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.SystemAdminClient
enableIncomingHooks := utils.Cfg.ServiceSettings.EnableIncomingWebhooks
@@ -203,7 +203,7 @@ func TestGetIncomingWebhook(t *testing.T) {
func TestDeleteIncomingWebhook(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.SystemAdminClient
enableIncomingHooks := utils.Cfg.ServiceSettings.EnableIncomingWebhooks
@@ -263,7 +263,7 @@ func TestDeleteIncomingWebhook(t *testing.T) {
func TestCreateOutgoingWebhook(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.Client
enableOutgoingHooks := utils.Cfg.ServiceSettings.EnableOutgoingWebhooks
@@ -316,7 +316,7 @@ func TestCreateOutgoingWebhook(t *testing.T) {
func TestGetOutgoingWebhooks(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.Client
enableOutgoingHooks := utils.Cfg.ServiceSettings.EnableOutgoingWebhooks
@@ -425,7 +425,7 @@ func TestGetOutgoingWebhooks(t *testing.T) {
func TestGetOutgoingWebhook(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.Client
enableOutgoingHooks := utils.Cfg.ServiceSettings.EnableOutgoingWebhooks
@@ -464,7 +464,7 @@ func TestGetOutgoingWebhook(t *testing.T) {
func TestUpdateIncomingHook(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.Client
enableIncomingHooks := utils.Cfg.ServiceSettings.EnableIncomingWebhooks
@@ -585,7 +585,7 @@ func TestUpdateIncomingHook(t *testing.T) {
utils.SetDefaultRolesBasedOnConfig()
Client.Logout()
- UpdateUserToTeamAdmin(th.BasicUser2, th.BasicTeam)
+ th.UpdateUserToTeamAdmin(th.BasicUser2, th.BasicTeam)
th.LoginBasic2()
t.Run("UpdateByDifferentUser", func(t *testing.T) {
updatedHook, resp := Client.UpdateIncomingWebhook(createdHook)
@@ -622,7 +622,7 @@ func TestUpdateIncomingHook(t *testing.T) {
team := th.CreateTeamWithClient(Client)
user := th.CreateUserWithClient(Client)
- LinkUserToTeam(user, team)
+ th.LinkUserToTeam(user, team)
Client.Logout()
Client.Login(user.Id, user.Password)
t.Run("UpdateToADifferentTeam", func(t *testing.T) {
@@ -633,7 +633,7 @@ func TestUpdateIncomingHook(t *testing.T) {
func TestRegenOutgoingHookToken(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.Client
enableOutgoingHooks := utils.Cfg.ServiceSettings.EnableOutgoingWebhooks
@@ -674,7 +674,7 @@ func TestRegenOutgoingHookToken(t *testing.T) {
func TestUpdateOutgoingHook(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.Client
enableOutgoingHooks := utils.Cfg.ServiceSettings.EnableOutgoingWebhooks
@@ -774,7 +774,7 @@ func TestUpdateOutgoingHook(t *testing.T) {
utils.SetDefaultRolesBasedOnConfig()
Client.Logout()
- UpdateUserToTeamAdmin(th.BasicUser2, th.BasicTeam)
+ th.UpdateUserToTeamAdmin(th.BasicUser2, th.BasicTeam)
th.LoginBasic2()
t.Run("RetainHookCreator", func(t *testing.T) {
createdHook.DisplayName = "Basic user 2"
@@ -830,7 +830,7 @@ func TestUpdateOutgoingHook(t *testing.T) {
team := th.CreateTeamWithClient(Client)
user := th.CreateUserWithClient(Client)
- LinkUserToTeam(user, team)
+ th.LinkUserToTeam(user, team)
Client.Logout()
Client.Login(user.Id, user.Password)
t.Run("UpdateToADifferentTeam", func(t *testing.T) {
@@ -841,7 +841,7 @@ func TestUpdateOutgoingHook(t *testing.T) {
func TestDeleteOutgoingHook(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
- defer TearDown()
+ defer th.TearDown()
Client := th.SystemAdminClient
enableIncomingHooks := utils.Cfg.ServiceSettings.EnableIncomingWebhooks
@@ -903,6 +903,8 @@ func TestDeleteOutgoingHook(t *testing.T) {
func TestCommandWebhooks(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
+ defer th.TearDown()
+
Client := th.SystemAdminClient
cmd := &model.Command{