<s> from __future__ import absolute_import , unicode_literals <EOL> from collections import defaultdict <EOL> from unittest . case import TestCase <EOL> from multitenancy import get_namespace <EOL> import multitenancy <EOL> class GetNamespaceTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> multitenancy . _subdomain_dct = defaultdict ( lambda : '<STR_LIT>' ) <EOL> multitenancy . _domain_dct = { } <EOL> def test_not_registered_namespace ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) <EOL> def test_registered_domain ( self ) : <EOL> multitenancy . set_domain ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) <EOL> def test_registered_subdomain ( self ) : <EOL> multitenancy . set_subdomain ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) <EOL> def test_domain_precedence ( self ) : <EOL> multitenancy . set_domain ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> multitenancy . set_subdomain ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) <EOL> def test_domain_with_port ( self ) : <EOL> multitenancy . set_domain ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> multitenancy . set_subdomain ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , get_namespace ( '<STR_LIT>' ) ) </s>
