diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-06 20:43:18 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-09-06 20:43:18 -0700 |
commit | 77709ccdda86408d5135b8bc71462e2111992358 (patch) | |
tree | 5efc1631eb6cb31f8768fafeb58612557d98cb59 /api4/oauth_test.go | |
parent | fd86a2490ea81eba8e12dcce76455710f182f81c (diff) | |
parent | e589accdaf38bb82cb5d3b5dd84eadf9bfb58b5c (diff) | |
download | chat-77709ccdda86408d5135b8bc71462e2111992358.tar.gz chat-77709ccdda86408d5135b8bc71462e2111992358.tar.bz2 chat-77709ccdda86408d5135b8bc71462e2111992358.zip |
Merge release-4.2
Diffstat (limited to 'api4/oauth_test.go')
-rw-r--r-- | api4/oauth_test.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/api4/oauth_test.go b/api4/oauth_test.go index 963cd43c3..ceb44a44e 100644 --- a/api4/oauth_test.go +++ b/api4/oauth_test.go @@ -28,7 +28,7 @@ func TestCreateOAuthApp(t *testing.T) { utils.Cfg.ServiceSettings.EnableOAuthServiceProvider = true utils.SetDefaultRolesBasedOnConfig() - oapp := &model.OAuthApp{Name: GenerateTestAppName(), Homepage: "https://nowhere.com", Description: "test", CallbackUrls: []string{"https://nowhere.com"}} + oapp := &model.OAuthApp{Name: GenerateTestAppName(), Homepage: "https://nowhere.com", Description: "test", CallbackUrls: []string{"https://nowhere.com"}, IsTrusted: true} rapp, resp := AdminClient.CreateOAuthApp(oapp) CheckNoError(t, resp) @@ -38,6 +38,10 @@ func TestCreateOAuthApp(t *testing.T) { t.Fatal("names did not match") } + if rapp.IsTrusted != oapp.IsTrusted { + t.Fatal("trusted did no match") + } + *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = true utils.SetDefaultRolesBasedOnConfig() _, resp = Client.CreateOAuthApp(oapp) @@ -45,10 +49,14 @@ func TestCreateOAuthApp(t *testing.T) { *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = false utils.SetDefaultRolesBasedOnConfig() - _, resp = Client.CreateOAuthApp(oapp) + rapp, resp = Client.CreateOAuthApp(oapp) CheckNoError(t, resp) CheckCreatedStatus(t, resp) + if rapp.IsTrusted { + t.Fatal("trusted should be false - created by non admin") + } + oapp.Name = "" _, resp = AdminClient.CreateOAuthApp(oapp) CheckBadRequestStatus(t, resp) |