summaryrefslogtreecommitdiffstats
path: root/tests_multitenant/test_middleware.py
blob: eabbbaa0b77384576c0e23f8825e3b969617c55e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)