summaryrefslogtreecommitdiffstats
path: root/api4/oauth_test.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2017-09-06 16:24:34 -0400
committerJoramWilander <jwawilander@gmail.com>2017-09-06 16:24:34 -0400
commitd38328976e2c8bb0fab91e656042a0d8ac37bc76 (patch)
tree7e3d1a96a007accfcea499857541f96890846122 /api4/oauth_test.go
parentf968c56890bd84295672ee0d46cc846cac2dbd47 (diff)
downloadchat-d38328976e2c8bb0fab91e656042a0d8ac37bc76.tar.gz
chat-d38328976e2c8bb0fab91e656042a0d8ac37bc76.tar.bz2
chat-d38328976e2c8bb0fab91e656042a0d8ac37bc76.zip
Various patches
Diffstat (limited to 'api4/oauth_test.go')
-rw-r--r--api4/oauth_test.go12
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)