Commit 8b9964a6 authored by Laurent Bachelier's avatar Laurent Bachelier

Add test for config initialization at the first request

And use a simpler method to find out the absolute root URL, which also
avoids storing :80 or :443 when the default HTTP or HTTPS port is used.
parent 8354d217
......@@ -108,8 +108,7 @@ class Context(object):
# store the absolute root url (useful when in CLI)
if not["web"].get("root_url"):["web"]["root_url"] = urlparse.urlunsplit(
(self.req.scheme,, self.root_url.href, '', ''))["web"]["root_url"] = self.req.host_url+self.root_url.href
def _init_templates(self):
......@@ -138,3 +138,11 @@ class BaseWebTest(TestCase):'/?_method=GET', status=405)'/?action=login', {'_method': 'HEAD'}, status=405)
def test_initConfig(self):
os.mkdir(os.path.join(self.root, "penguins"))'http://ass2m.test/penguins/', status=200)
storage = Storage.lookup(self.root)
assert storage.get_config().data['web']['root_url'] == 'http://ass2m.test/'
assert storage.get_config().data['web']['cookie_secret']
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment