summaryrefslogtreecommitdiff
path: root/pyramid/tests/test_url.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyramid/tests/test_url.py')
-rw-r--r--pyramid/tests/test_url.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/pyramid/tests/test_url.py b/pyramid/tests/test_url.py
index f6117777f..9cee7f61c 100644
--- a/pyramid/tests/test_url.py
+++ b/pyramid/tests/test_url.py
@@ -93,6 +93,14 @@ class TestURLMethodsMixin(unittest.TestCase):
result = request.resource_url(context, 'a b c')
self.assertEqual(result, 'http://example.com:5432/context/a%20b%20c')
+ def test_resource_url_with_query_str(self):
+ request = self._makeOne()
+ self._registerResourceURL(request.registry)
+ context = DummyContext()
+ result = request.resource_url(context, 'a', query='(openlayers)')
+ self.assertEqual(result,
+ 'http://example.com:5432/context/a?%28openlayers%29')
+
def test_resource_url_with_query_dict(self):
request = self._makeOne()
self._registerResourceURL(request.registry)
@@ -483,6 +491,15 @@ class TestURLMethodsMixin(unittest.TestCase):
self.assertEqual(result,
'http://example.com:5432/1/2/3?q=1')
+ def test_route_url_with_query_str(self):
+ from pyramid.interfaces import IRoutesMapper
+ request = self._makeOne()
+ mapper = DummyRoutesMapper(route=DummyRoute('/1/2/3'))
+ request.registry.registerUtility(mapper, IRoutesMapper)
+ result = request.route_url('flub', _query='(openlayers)')
+ self.assertEqual(result,
+ 'http://example.com:5432/1/2/3?%28openlayers%29')
+
def test_route_url_with_empty_query(self):
from pyramid.interfaces import IRoutesMapper
request = self._makeOne()