diff options
author | Stan Hu <stanhu@gmail.com> | 2016-10-12 06:51:57 -0700 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-10-12 09:51:57 -0400 |
commit | d4268cf0d86cee4d51fa1877ccf47b2a69b65cd4 (patch) | |
tree | 29cb721757995bff6a881dbee5db60ace9e9486b /api/context_test.go | |
parent | d195eea07de0654fb716d856448d6f10a2a7a0ff (diff) | |
download | chat-d4268cf0d86cee4d51fa1877ccf47b2a69b65cd4.tar.gz chat-d4268cf0d86cee4d51fa1877ccf47b2a69b65cd4.tar.bz2 chat-d4268cf0d86cee4d51fa1877ccf47b2a69b65cd4.zip |
Trim trailing slashes to prevent OAuth2 URI mismatch errors (#4204)
Closes https://gitlab.com/gitlab-org/gitlab-mattermost/issues/84
Diffstat (limited to 'api/context_test.go')
-rw-r--r-- | api/context_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/api/context_test.go b/api/context_test.go index 88ba0f665..2227b7f65 100644 --- a/api/context_test.go +++ b/api/context_test.go @@ -29,3 +29,24 @@ func TestCache(t *testing.T) { t.Fatal("should have one less") } } + +func TestSiteURL(t *testing.T) { + c := &Context{} + + testCases := []struct { + url string + want string + }{ + {"http://mattermost.com/", "http://mattermost.com"}, + {"http://mattermost.com", "http://mattermost.com"}, + } + + for _, tc := range testCases { + c.SetSiteURL(tc.url) + + if c.siteURL != tc.want { + t.Fatalf("expected %s, got %s", tc.want, c.siteURL) + } + } + +} |