예제 #1
0
 def test_nonSubdomain(self):
     """
     L{VirtualHostWrapper.subdomain} returns C{None} when passed a hostname
     which is not a subdomain of a domain of the site.
     """
     site = Store()
     wrapper = VirtualHostWrapper(site, None, None)
     self.assertIdentical(wrapper.subdomain("example.com"), None)
예제 #2
0
 def test_nonSubdomain(self):
     """
     L{VirtualHostWrapper.subdomain} returns C{None} when passed a hostname
     which is not a subdomain of a domain of the site.
     """
     site = Store()
     wrapper = VirtualHostWrapper(site, None, None)
     self.assertIdentical(wrapper.subdomain("example.com"), None)
예제 #3
0
 def test_wwwSubdomain(self):
     """
     L{VirtualHostWrapper.subdomain} returns C{None} when passed a hostname
     which is the I{www} subdomain of a domain of the site.
     """
     site = Store()
     wrapper = VirtualHostWrapper(site, None, None)
     userbase.LoginMethod(store=site,
                          account=site,
                          protocol=u'*',
                          internal=True,
                          verified=True,
                          localpart=u'alice',
                          domain=u'example.com')
     self.assertIdentical(wrapper.subdomain("www.example.com"), None)
예제 #4
0
 def test_subdomainWithPort(self):
     """
     L{VirtualHostWrapper.subdomain} handles hostnames with a port component
     as if they did not have a port component.
     """
     site = Store()
     wrapper = VirtualHostWrapper(site, None, None)
     userbase.LoginMethod(store=site,
                          account=site,
                          protocol=u'*',
                          internal=True,
                          verified=True,
                          localpart=u'alice',
                          domain=u'example.com')
     self.assertEqual(wrapper.subdomain("bob.example.com:8080"),
                      ("bob", "example.com"))
예제 #5
0
 def test_wwwSubdomain(self):
     """
     L{VirtualHostWrapper.subdomain} returns C{None} when passed a hostname
     which is the I{www} subdomain of a domain of the site.
     """
     site = Store()
     wrapper = VirtualHostWrapper(site, None, None)
     userbase.LoginMethod(
         store=site,
         account=site,
         protocol=u'*',
         internal=True,
         verified=True,
         localpart=u'alice',
         domain=u'example.com')
     self.assertIdentical(wrapper.subdomain("www.example.com"), None)
예제 #6
0
 def test_subdomain(self):
     """
     L{VirtualHostWrapper.subdomain} returns a two-tuple of a username and a
     domain name when passed a hostname which is a subdomain of a known
     domain.
     """
     site = Store()
     wrapper = VirtualHostWrapper(site, None, None)
     userbase.LoginMethod(store=site,
                          account=site,
                          protocol=u'*',
                          internal=True,
                          verified=True,
                          localpart=u'alice',
                          domain=u'example.com')
     self.assertEqual(wrapper.subdomain("bob.example.com"),
                      ("bob", "example.com"))
예제 #7
0
 def test_subdomainWithPort(self):
     """
     L{VirtualHostWrapper.subdomain} handles hostnames with a port component
     as if they did not have a port component.
     """
     site = Store()
     wrapper = VirtualHostWrapper(site, None, None)
     userbase.LoginMethod(
         store=site,
         account=site,
         protocol=u'*',
         internal=True,
         verified=True,
         localpart=u'alice',
         domain=u'example.com')
     self.assertEqual(
         wrapper.subdomain("bob.example.com:8080"),
         ("bob", "example.com"))
예제 #8
0
 def test_subdomain(self):
     """
     L{VirtualHostWrapper.subdomain} returns a two-tuple of a username and a
     domain name when passed a hostname which is a subdomain of a known
     domain.
     """
     site = Store()
     wrapper = VirtualHostWrapper(site, None, None)
     userbase.LoginMethod(
         store=site,
         account=site,
         protocol=u'*',
         internal=True,
         verified=True,
         localpart=u'alice',
         domain=u'example.com')
     self.assertEqual(
         wrapper.subdomain("bob.example.com"),
         ("bob", "example.com"))