summaryrefslogtreecommitdiffstats
path: root/api/admin_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-07-04 16:12:02 -0400
committerGitHub <noreply@github.com>2017-07-04 16:12:02 -0400
commit8ec8948c84e946fde736add0c4e6dd55f6efd1ab (patch)
treeb6388c965c797d4dfe9c860b93b4249107b9a7b0 /api/admin_test.go
parent4bd7b68b24137a9f8fe0abc908831cf95bb6c32b (diff)
downloadchat-8ec8948c84e946fde736add0c4e6dd55f6efd1ab.tar.gz
chat-8ec8948c84e946fde736add0c4e6dd55f6efd1ab.tar.bz2
chat-8ec8948c84e946fde736add0c4e6dd55f6efd1ab.zip
PLT-6554 Add config setting to control enabling API version 3 (#6835)
* Add config setting to control enabling API version 3 * Update help text for APIv3 config setting (#6843) * Update configuration_settings.jsx * Update en.json
Diffstat (limited to 'api/admin_test.go')
-rw-r--r--api/admin_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/api/admin_test.go b/api/admin_test.go
index a93257626..d5f24b715 100644
--- a/api/admin_test.go
+++ b/api/admin_test.go
@@ -4,6 +4,7 @@
package api
import (
+ "net/http"
"strings"
"testing"
@@ -652,3 +653,24 @@ func TestGetRecentlyActiveUsers(t *testing.T) {
t.Fatal("should have been at least 2")
}
}
+
+func TestDisableAPIv3(t *testing.T) {
+ th := Setup().InitBasic()
+ Client := th.BasicClient
+
+ enableAPIv3 := *utils.Cfg.ServiceSettings.EnableAPIv3
+ defer func() {
+ *utils.Cfg.ServiceSettings.EnableAPIv3 = enableAPIv3
+ }()
+ *utils.Cfg.ServiceSettings.EnableAPIv3 = false
+
+ _, err := Client.GetUser(th.BasicUser.Id, "")
+
+ if err.StatusCode != http.StatusNotImplemented {
+ t.Fatal("wrong error code")
+ }
+
+ if err.Id != "api.context.v3_disabled.app_error" {
+ t.Fatal("wrong error message")
+ }
+}