Allow empty reseller prefixes in domain_remap
Change-Id: I2013e4686fce1c06626ec974f8d721721e6ca6e7
This commit is contained in:
parent
7a24c4ba3a
commit
85c91a4e82
@ -98,6 +98,7 @@ class DomainRemapMiddleware(object):
|
||||
body='Bad domain in host header',
|
||||
content_type='text/plain')
|
||||
return resp(env, start_response)
|
||||
if len(self.reseller_prefixes) > 0:
|
||||
if '_' not in account and '-' in account:
|
||||
account = account.replace('-', '_', 1)
|
||||
account_reseller_prefix = account.split('_', 1)[0].lower()
|
||||
|
@ -130,6 +130,14 @@ class TestDomainRemap(unittest.TestCase):
|
||||
resp = self.app(req.environ, start_response)
|
||||
self.assertEquals(resp, '/test')
|
||||
|
||||
def test_domain_remap_configured_with_no_prefixes(self):
|
||||
conf = {'reseller_prefixes': ''}
|
||||
self.app = domain_remap.DomainRemapMiddleware(FakeApp(), conf)
|
||||
req = Request.blank('/test', environ={'REQUEST_METHOD': 'GET'},
|
||||
headers={'Host': 'c.uuid.example.com'})
|
||||
resp = self.app(req.environ, start_response)
|
||||
self.assertEquals(resp, '/v1/uuid/c/test')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user