16 lines
515 B
Python
16 lines
515 B
Python
from hobo.multitenant.middleware import TenantMiddleware
|
|
|
|
|
|
def test_hostname2schema():
|
|
assert TenantMiddleware.hostname2schema('x' * 63) == ('x' * 63)
|
|
shortened = TenantMiddleware.hostname2schema('x' * 64)
|
|
# no more than 63 characters
|
|
assert len(shortened) == 63
|
|
# it's different than just the 63 first characters
|
|
assert shortened != ('x' * 63)
|
|
# but it matches the prefix
|
|
assert shortened[:20] == ('x' * 20)
|
|
# and it matches the suffix
|
|
assert shortened[-20:] == ('x' * 20)
|
|
|