From 33e20b874e9709fc8d9e45ffb8d0c2357bc79e8d Mon Sep 17 00:00:00 2001 From: enahum Date: Tue, 20 Sep 2016 13:02:08 -0300 Subject: PLT-4202 fix javascript error manage OAuth2 apps (#4039) * PLT-4202 fix javascript error manage OAuth2 apps * Fix unit tests --- api/oauth.go | 1 + api/oauth_test.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'api') diff --git a/api/oauth.go b/api/oauth.go index 18a9979f6..233ae0879 100644 --- a/api/oauth.go +++ b/api/oauth.go @@ -102,6 +102,7 @@ func getOAuthApps(c *Context, w http.ResponseWriter, r *http.Request) { if HasPermissionToContext(c, model.PERMISSION_MANAGE_SYSTEM_WIDE_OAUTH) { ochan = Srv.Store.OAuth().GetApps() } else { + c.Err = nil ochan = Srv.Store.OAuth().GetAppByUser(c.Session.UserId) } diff --git a/api/oauth_test.go b/api/oauth_test.go index da069aefe..1dcdd55e3 100644 --- a/api/oauth_test.go +++ b/api/oauth_test.go @@ -156,8 +156,8 @@ func TestGetOAuthAppsByUser(t *testing.T) { utils.Cfg.ServiceSettings.EnableOAuthServiceProvider = true - if _, err := Client.GetOAuthAppsByUser(); err == nil { - t.Fatal("Should have failed. only admin is permitted") + if _, err := Client.GetOAuthAppsByUser(); err != nil { + t.Fatal("Should have passed.") } *utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = false -- cgit v1.2.3-1-g7c22