def test_domain_resolver_translation(self):
     with override_settings(USE_SUBDOMAIN=False):
         url = resolve_domain(project=self.translation)
         self.assertEqual(url, 'readthedocs.org')
     with override_settings(USE_SUBDOMAIN=True):
         url = resolve_domain(project=self.translation)
         self.assertEqual(url, 'pip.readthedocs.org')
示例#2
0
 def test_domain_resolver_translation(self):
     with override_settings(USE_SUBDOMAIN=False):
         url = resolve_domain(project=self.translation)
         self.assertEqual(url, 'readthedocs.org')
     with override_settings(USE_SUBDOMAIN=True):
         url = resolve_domain(project=self.translation)
         self.assertEqual(url, 'pip.readthedocs.org')
示例#3
0
 def test_domain_resolver_with_domain_object(self):
     self.domain = get(Domain, domain='docs.foobar.com', project=self.pip, canonical=True)
     with override_settings(USE_SUBDOMAIN=False):
         url = resolve_domain(project=self.pip)
         self.assertEqual(url, 'docs.foobar.com')
     with override_settings(USE_SUBDOMAIN=True):
         url = resolve_domain(project=self.pip)
         self.assertEqual(url, 'docs.foobar.com')
 def test_domain_resolver_with_domain_object(self):
     self.domain = get(Domain, domain='docs.foobar.com', project=self.pip, canonical=True)
     with override_settings(USE_SUBDOMAIN=False):
         url = resolve_domain(project=self.pip)
         self.assertEqual(url, 'docs.foobar.com')
     with override_settings(USE_SUBDOMAIN=True):
         url = resolve_domain(project=self.pip)
         self.assertEqual(url, 'docs.foobar.com')
示例#5
0
 def test_domain_public(self):
     with override_settings(USE_SUBDOMAIN=False):
         url = resolve_domain(project=self.translation)
         self.assertEqual(url, 'readthedocs.org')
     with override_settings(USE_SUBDOMAIN=True):
         url = resolve_domain(project=self.translation)
         self.assertEqual(url, 'pip.public.readthedocs.org')
     # Private overrides domain
     with override_settings(USE_SUBDOMAIN=False):
         url = resolve_domain(project=self.translation, private=True)
         self.assertEqual(url, 'readthedocs.org')
     with override_settings(USE_SUBDOMAIN=True):
         url = resolve_domain(project=self.translation, private=True)
         self.assertEqual(url, 'pip.public.readthedocs.org')
 def test_domain_public(self):
     with override_settings(USE_SUBDOMAIN=False):
         url = resolve_domain(project=self.translation)
         self.assertEqual(url, 'readthedocs.org')
     with override_settings(USE_SUBDOMAIN=True):
         url = resolve_domain(project=self.translation)
         self.assertEqual(url, 'pip.public.readthedocs.org')
     # Private overrides domain
     with override_settings(USE_SUBDOMAIN=False):
         url = resolve_domain(project=self.translation, private=True)
         self.assertEqual(url, 'readthedocs.org')
     with override_settings(USE_SUBDOMAIN=True):
         url = resolve_domain(project=self.translation, private=True)
         self.assertEqual(url, 'pip.public.readthedocs.org')
示例#7
0
    def test_domain_resolver_translation_itself(self):
        """
        Test inconsistent project/translation relationship.

        If a project is a translation of itself (inconsistent relationship) we
        still resolves the proper domain.
        """
        # remove all possible translations relationships
        self.pip.translations.all().delete()

        # add the project as subproject of itself
        self.pip.translations.add(self.pip)

        with override_settings(USE_SUBDOMAIN=False):
            url = resolve_domain(project=self.pip)
            self.assertEqual(url, 'readthedocs.org')
        with override_settings(USE_SUBDOMAIN=True):
            url = resolve_domain(project=self.pip)
            self.assertEqual(url, 'pip.readthedocs.org')
    def test_domain_resolver_translation_itself(self):
        """
        Test inconsistent project/translation relationship.

        If a project is a translation of itself (inconsistent relationship) we
        still resolves the proper domain.
        """
        # remove all possible translations relationships
        self.pip.translations.all().delete()

        # add the project as subproject of itself
        self.pip.translations.add(self.pip)

        with override_settings(USE_SUBDOMAIN=False):
            url = resolve_domain(project=self.pip)
            self.assertEqual(url, 'readthedocs.org')
        with override_settings(USE_SUBDOMAIN=True):
            url = resolve_domain(project=self.pip)
            self.assertEqual(url, 'pip.readthedocs.org')
示例#9
0
 def subdomain(self):
     """Get project subdomain from resolver."""
     return resolve_domain(self)
示例#10
0
 def subdomain(self):
     """Get project subdomain from resolver."""
     return resolve_domain(self)