From 9bc7af0c5704bbf73f8240b4569d5ea215352e39 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 2 Oct 2017 03:50:56 -0500 Subject: 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 --- api4/webhook_test.go | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'api4/webhook_test.go') 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{ -- cgit v1.2.3-1-g7c22