From 07a1952f280f80e0a65f0d7750d2fafb492c76b5 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 20 Aug 2010 11:16:18 +0200 Subject: [PATCH] Added testcase. This fixes #108 --- tests/flask_tests.py | 9 +++++++++ tests/subdomaintestmodule/__init__.py | 4 ++++ tests/subdomaintestmodule/static/hello.txt | 1 + 3 files changed, 14 insertions(+) create mode 100644 tests/subdomaintestmodule/__init__.py create mode 100644 tests/subdomaintestmodule/static/hello.txt diff --git a/tests/flask_tests.py b/tests/flask_tests.py index c41bf5f7..fc911ca8 100644 --- a/tests/flask_tests.py +++ b/tests/flask_tests.py @@ -1049,6 +1049,15 @@ class SubdomainTestCase(unittest.TestCase): rv = c.get('/', 'http://test.localhost/') assert rv.data == 'test index' + def test_module_static_path_subdomain(self): + app = flask.Flask(__name__) + app.config['SERVER_NAME'] = 'example.com' + from subdomaintestmodule import mod + app.register_module(mod) + c = app.test_client() + rv = c.get('/static/hello.txt', 'http://foo.example.com/') + assert rv.data.strip() == 'Hello Subdomain' + def test_subdomain_matching(self): app = flask.Flask(__name__) app.config['SERVER_NAME'] = 'localhost' diff --git a/tests/subdomaintestmodule/__init__.py b/tests/subdomaintestmodule/__init__.py new file mode 100644 index 00000000..3c5e3583 --- /dev/null +++ b/tests/subdomaintestmodule/__init__.py @@ -0,0 +1,4 @@ +from flask import Module + + +mod = Module(__name__, 'foo', subdomain='foo') diff --git a/tests/subdomaintestmodule/static/hello.txt b/tests/subdomaintestmodule/static/hello.txt new file mode 100644 index 00000000..12e23c16 --- /dev/null +++ b/tests/subdomaintestmodule/static/hello.txt @@ -0,0 +1 @@ +Hello Subdomain