From ba64d4ee2964e95e7b6b12c68e7a4d47ad0ed095 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 25 Aug 2017 14:59:49 -0700 Subject: [PATCH] server_settings: Add additional subdomains test case. This will help preserve 100% test coverage as we refactor to set REALMS_HAVE_SUBDOMAINS=True unconditonally. --- zerver/tests/test_auth_backends.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.py index 31964f57a8..acc5d397ca 100644 --- a/zerver/tests/test_auth_backends.py +++ b/zerver/tests/test_auth_backends.py @@ -1443,7 +1443,27 @@ class FetchAuthBackends(ZulipTestCase): with self.settings(REALMS_HAVE_SUBDOMAINS=True, ROOT_DOMAIN_LANDING_PAGE=False): result = self.client_get("/api/v1/server_settings", - HTTP_HOST="zulip.testserver") + subdomain="") + self.assert_json_success(result) + data = result.json() + schema_checker = check_dict_only([ + ('authentication_methods', check_dict_only([ + ('google', check_bool), + ('github', check_bool), + ('dev', check_bool), + ('password', check_bool), + ])), + ('realm_uri', check_string), + ('zulip_version', check_string), + ('msg', check_string), + ('result', check_string), + ]) + self.assert_on_error(schema_checker("data", data)) + + with self.settings(REALMS_HAVE_SUBDOMAINS=True, + ROOT_DOMAIN_LANDING_PAGE=False): + result = self.client_get("/api/v1/server_settings", + subdomain="zulip") self.assert_json_success(result) data = result.json() with_realm_schema_checker = check_dict_only([