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 --- api/oauth_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'api/oauth_test.go') diff --git a/api/oauth_test.go b/api/oauth_test.go index 317478b0a..0e952768e 100644 --- a/api/oauth_test.go +++ b/api/oauth_test.go @@ -19,6 +19,8 @@ import ( func TestOAuthRegisterApp(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() + defer th.TearDown() + Client := th.BasicClient oauthApp := &model.OAuthApp{Name: "TestApp" + model.NewId(), Homepage: "https://nowhere.com", Description: "test", CallbackUrls: []string{"https://nowhere.com"}, IsTrusted: true} @@ -108,6 +110,8 @@ func TestOAuthRegisterApp(t *testing.T) { func TestOAuthAllow(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() + defer th.TearDown() + Client := th.BasicClient AdminClient := th.SystemAdminClient @@ -193,6 +197,8 @@ func TestOAuthAllow(t *testing.T) { func TestOAuthGetAppsByUser(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() + defer th.TearDown() + Client := th.BasicClient AdminClient := th.SystemAdminClient @@ -263,6 +269,8 @@ func TestOAuthGetAppsByUser(t *testing.T) { func TestOAuthGetAppInfo(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() + defer th.TearDown() + Client := th.BasicClient AdminClient := th.SystemAdminClient @@ -291,6 +299,8 @@ func TestOAuthGetAppInfo(t *testing.T) { func TestOAuthGetAuthorizedApps(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() + defer th.TearDown() + Client := th.BasicClient AdminClient := th.SystemAdminClient @@ -324,6 +334,8 @@ func TestOAuthGetAuthorizedApps(t *testing.T) { func TestOAuthDeauthorizeApp(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() + defer th.TearDown() + Client := th.BasicClient AdminClient := th.SystemAdminClient @@ -375,6 +387,8 @@ func TestOAuthDeauthorizeApp(t *testing.T) { func TestOAuthRegenerateAppSecret(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() + defer th.TearDown() + Client := th.BasicClient AdminClient := th.SystemAdminClient @@ -416,6 +430,8 @@ func TestOAuthRegenerateAppSecret(t *testing.T) { func TestOAuthDeleteApp(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() + defer th.TearDown() + Client := th.BasicClient AdminClient := th.SystemAdminClient @@ -547,6 +563,8 @@ func TestOAuthAccessToken(t *testing.T) { } th := Setup().InitBasic() + defer th.TearDown() + Client := th.BasicClient enableOAuth := utils.Cfg.ServiceSettings.EnableOAuthServiceProvider @@ -764,6 +782,8 @@ func TestOAuthComplete(t *testing.T) { } th := Setup().InitBasic() + defer th.TearDown() + Client := th.BasicClient if r, err := HttpGet(Client.Url+"/login/gitlab/complete", Client.HttpClient, "", true); err == nil { @@ -806,6 +826,14 @@ func TestOAuthComplete(t *testing.T) { // We are going to use mattermost as the provider emulating gitlab utils.Cfg.ServiceSettings.EnableOAuthServiceProvider = true + adminOnly := *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations + defer func() { + *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = adminOnly + utils.SetDefaultRolesBasedOnConfig() + }() + *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = false + utils.SetDefaultRolesBasedOnConfig() + oauthApp := &model.OAuthApp{ Name: "TestApp5" + model.NewId(), Homepage: "https://nowhere.com", -- cgit v1.2.3-1-g7c22