예제 #1
0
 def test_api_url_view_subdomains_full(self) -> None:
     context = dict()  # type: Dict[str, Any]
     request = HostRequestMock(host="mysubdomain.testserver")
     add_api_uri_context(context, request)
     self.assertEqual(context["api_url_scheme_relative"], "mysubdomain.testserver/api")
     self.assertEqual(context["api_url"], "http://mysubdomain.testserver/api")
     self.assertTrue(context["html_settings_links"])
예제 #2
0
 def test_api_url_view_subdomains_homepage_base(self):
     # type: () -> None
     context = dict()  # type: Dict[str, Any]
     add_api_uri_context(context, HostRequestMock())
     self.assertEqual(context["api_url_scheme_relative"], "yourZulipDomain.testserver/api")
     self.assertEqual(context["api_url"], "http://yourZulipDomain.testserver/api")
     self.assertFalse(context["html_settings_links"])
예제 #3
0
 def test_api_url_view_subdomains_full(self) -> None:
     context = dict()  # type: Dict[str, Any]
     request = HostRequestMock(host="mysubdomain.testserver")
     add_api_uri_context(context, request)
     self.assertEqual(context["api_url_scheme_relative"], "mysubdomain.testserver/api")
     self.assertEqual(context["api_url"], "http://mysubdomain.testserver/api")
     self.assertTrue(context["html_settings_links"])
예제 #4
0
 def test_api_url_view_subdomains_homepage_base(self):
     # type: () -> None
     context = dict()  # type: Dict[str, Any]
     add_api_uri_context(context, HostRequestMock())
     self.assertEqual(context["api_url_scheme_relative"], "yourZulipDomain.testserver/api")
     self.assertEqual(context["api_url"], "http://yourZulipDomain.testserver/api")
     self.assertFalse(context["html_settings_links"])
예제 #5
0
파일: test_docs.py 프로젝트: waveyuk/zulip
 def test_api_url_view_subdomains_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"])
예제 #6
0
파일: test_docs.py 프로젝트: waveyuk/zulip
 def test_api_url_view_subdomains_full(self):
     # type: () -> None
     context = dict()  # type: Dict[str, Any]
     request = HostRequestMock(host="mysubdomain.testserver")
     add_api_uri_context(context, request)
     self.assertEqual(context["external_api_path_subdomain"],
                      "mysubdomain.testserver/api")
     self.assertEqual(context["external_api_uri_subdomain"],
                      "http://mysubdomain.testserver/api")
     self.assertTrue(context["html_settings_links"])
예제 #7
0
    def test_html_settings_links(self) -> None:
        context = dict()  # type: Dict[str, Any]
        with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
            add_api_uri_context(context, HostRequestMock())
        self.assertEqual(
            context['settings_html'],
            'Zulip settings page')
        self.assertEqual(
            context['subscriptions_html'],
            'streams page')

        context = dict()
        with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
            add_api_uri_context(context, HostRequestMock(host="mysubdomain.testserver"))
        self.assertEqual(
            context['settings_html'],
            '<a href="/#settings">Zulip settings page</a>')
        self.assertEqual(
            context['subscriptions_html'],
            '<a target="_blank" href="/#streams">streams page</a>')

        context = dict()
        add_api_uri_context(context, HostRequestMock())
        self.assertEqual(
            context['settings_html'],
            '<a href="/#settings">Zulip settings page</a>')
        self.assertEqual(
            context['subscriptions_html'],
            '<a target="_blank" href="/#streams">streams page</a>')
예제 #8
0
    def test_html_settings_links(self) -> None:
        context = dict()  # type: Dict[str, Any]
        with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
            add_api_uri_context(context, HostRequestMock())
        self.assertEqual(
            context['settings_html'],
            'Zulip settings page')
        self.assertEqual(
            context['subscriptions_html'],
            'streams page')

        context = dict()
        with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
            add_api_uri_context(context, HostRequestMock(host="mysubdomain.testserver"))
        self.assertEqual(
            context['settings_html'],
            '<a href="/#settings">Zulip settings page</a>')
        self.assertEqual(
            context['subscriptions_html'],
            '<a target="_blank" href="/#streams">streams page</a>')

        context = dict()
        add_api_uri_context(context, HostRequestMock())
        self.assertEqual(
            context['settings_html'],
            '<a href="/#settings">Zulip settings page</a>')
        self.assertEqual(
            context['subscriptions_html'],
            '<a target="_blank" href="/#streams">streams page</a>')
예제 #9
0
 def test_api_url_view_subdomains_base(self) -> None:
     context = dict()  # type: Dict[str, Any]
     add_api_uri_context(context, HostRequestMock())
     self.assertEqual(context["api_url_scheme_relative"], "testserver/api")
     self.assertEqual(context["api_url"], "http://testserver/api")
     self.assertTrue(context["html_settings_links"])
예제 #10
0
 def test_api_url_view_subdomains_base(self) -> None:
     context = dict()  # type: Dict[str, Any]
     add_api_uri_context(context, HostRequestMock())
     self.assertEqual(context["api_url_scheme_relative"], "testserver/api")
     self.assertEqual(context["api_url"], "http://testserver/api")
     self.assertTrue(context["html_settings_links"])
예제 #11
0
 def test_api_url_view_base(self):
     # type: () -> None
     context = dict()  # type: Dict[str, Any]
     add_api_uri_context(context, RequestMock())
     self.assertEqual(context["external_api_path_subdomain"], "localhost:9991/api")
     self.assertEqual(context["external_api_uri_subdomain"], "http://localhost:9991/api")