diff tests/test_baking_baker.py @ 568:6b6c5442c790

bug: Correctly handle root URLs with special characters. The `site/root` setting is now pre-escaped to get a correct URL, and routing excludes it from escaping. Add unit tests.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 13 Oct 2015 22:50:38 -0700
parents e7b865f8f335
children 34e57d4b97e2
line wrap: on
line diff
--- a/tests/test_baking_baker.py	Tue Oct 13 22:46:05 2015 -0700
+++ b/tests/test_baking_baker.py	Tue Oct 13 22:50:38 2015 -0700
@@ -1,5 +1,6 @@
 import time
 import os.path
+import urllib.parse
 import pytest
 from piecrust.baking.baker import Baker
 from piecrust.baking.single import PageBaker
@@ -41,8 +42,8 @@
         app.config.set('site/pretty_urls', True)
     assert app.config.get('site/pretty_urls') == pretty
 
-    for site_root in ['/', '/whatever/']:
-        app.config.set('site/root', site_root)
+    for site_root in ['/', '/whatever/', '/~johndoe/']:
+        app.config.set('site/root', urllib.parse.quote(site_root))
         baker = PageBaker(app, '/destination')
         path = baker.getOutputPath(site_root + uri)
         expected = os.path.normpath(