summaryrefslogtreecommitdiffstats
path: root/tests_multitenant/test_middleware.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests_multitenant/test_middleware.py')
-rw-r--r--tests_multitenant/test_middleware.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests_multitenant/test_middleware.py b/tests_multitenant/test_middleware.py
new file mode 100644
index 0000000..eabbbaa
--- /dev/null
+++ b/tests_multitenant/test_middleware.py
@@ -0,0 +1,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)
+