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)
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)
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"))
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)
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"))
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"))
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"))