subdomains: Hardcode REALMS_HAVE_SUBDOMAINS in API docs.

This commit is contained in:
Tim Abbott 2017-10-01 22:59:20 -07:00
parent 262a0692ab
commit 66658bbf25
2 changed files with 10 additions and 26 deletions

View File

@ -108,16 +108,6 @@ class IntegrationTest(TestCase):
for integration in HUBOT_LOZENGES.values(): for integration in HUBOT_LOZENGES.values():
self.assertTrue(os.path.isfile(os.path.join(DEPLOY_ROOT, integration.logo))) self.assertTrue(os.path.isfile(os.path.join(DEPLOY_ROOT, integration.logo)))
@override_settings(REALMS_HAVE_SUBDOMAINS=False)
def test_api_url_view_base(self):
# type: () -> None
context = dict() # type: Dict[str, Any]
add_api_uri_context(context, HostRequestMock())
self.assertEqual(context["external_api_path_subdomain"], "testserver/api")
self.assertEqual(context["external_api_uri_subdomain"], "http://testserver/api")
self.assertTrue(context["html_settings_links"])
@override_settings(REALMS_HAVE_SUBDOMAINS=True)
def test_api_url_view_subdomains_base(self): def test_api_url_view_subdomains_base(self):
# type: () -> None # type: () -> None
context = dict() # type: Dict[str, Any] context = dict() # type: Dict[str, Any]
@ -126,7 +116,6 @@ class IntegrationTest(TestCase):
self.assertEqual(context["external_api_uri_subdomain"], "http://testserver/api") self.assertEqual(context["external_api_uri_subdomain"], "http://testserver/api")
self.assertTrue(context["html_settings_links"]) self.assertTrue(context["html_settings_links"])
@override_settings(REALMS_HAVE_SUBDOMAINS=True)
@override_settings(ROOT_DOMAIN_LANDING_PAGE=True) @override_settings(ROOT_DOMAIN_LANDING_PAGE=True)
def test_api_url_view_subdomains_homepage_base(self): def test_api_url_view_subdomains_homepage_base(self):
# type: () -> None # type: () -> None
@ -136,7 +125,6 @@ class IntegrationTest(TestCase):
self.assertEqual(context["external_api_uri_subdomain"], "http://yourZulipDomain.testserver/api") self.assertEqual(context["external_api_uri_subdomain"], "http://yourZulipDomain.testserver/api")
self.assertFalse(context["html_settings_links"]) self.assertFalse(context["html_settings_links"])
@override_settings(REALMS_HAVE_SUBDOMAINS=True)
def test_api_url_view_subdomains_full(self): def test_api_url_view_subdomains_full(self):
# type: () -> None # type: () -> None
context = dict() # type: Dict[str, Any] context = dict() # type: Dict[str, Any]

View File

@ -17,7 +17,6 @@ from zerver.templatetags.app_filters import render_markdown_path
def add_api_uri_context(context, request): def add_api_uri_context(context, request):
# type: (Dict[str, Any], HttpRequest) -> None # type: (Dict[str, Any], HttpRequest) -> None
if settings.REALMS_HAVE_SUBDOMAINS:
subdomain = get_subdomain(request) subdomain = get_subdomain(request)
if subdomain or not settings.ROOT_DOMAIN_LANDING_PAGE: if subdomain or not settings.ROOT_DOMAIN_LANDING_PAGE:
display_subdomain = subdomain display_subdomain = subdomain
@ -30,9 +29,6 @@ def add_api_uri_context(context, request):
settings.EXTERNAL_API_PATH) settings.EXTERNAL_API_PATH)
else: else:
external_api_path_subdomain = settings.EXTERNAL_API_PATH external_api_path_subdomain = settings.EXTERNAL_API_PATH
else:
external_api_path_subdomain = settings.EXTERNAL_API_PATH
html_settings_links = True
external_api_uri_subdomain = '%s%s' % (settings.EXTERNAL_URI_SCHEME, external_api_uri_subdomain = '%s%s' % (settings.EXTERNAL_URI_SCHEME,
external_api_path_subdomain) external_api_path_subdomain)