summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorianb <devnull@localhost>2008-02-17 17:33:04 +0000
committerianb <devnull@localhost>2008-02-17 17:33:04 +0000
commit93079ddfb7b5ab52fdf1a41e372ff8b41b35d759 (patch)
treeb0128dd668ccd6aec5a382108efc10ba86f79530
parent09596eaa928fe973bacb31ee1e0fe73a252df040 (diff)
downloadpaste-93079ddfb7b5ab52fdf1a41e372ff8b41b35d759.tar.gz
Look for params values that have an .items method
-rw-r--r--docs/news.txt4
-rw-r--r--paste/fixture.py3
-rw-r--r--tests/test_fixture.py5
3 files changed, 11 insertions, 1 deletions
diff --git a/docs/news.txt b/docs/news.txt
index a7130e1..03302fd 100644
--- a/docs/news.txt
+++ b/docs/news.txt
@@ -13,6 +13,10 @@ svn trunk
* Make `paste.cascade` notice sockets that have stopped producing
data. From Casey Zednick.
+* In ``paste.fixture.TestApp`` Accept MultiDict values for the
+ ``params`` argument in requests. (Anything with a ``.items()``
+ method will have its items encoded as the request parameters.)
+
1.6.1
-----
diff --git a/paste/fixture.py b/paste/fixture.py
index 25d0c07..01ffc08 100644
--- a/paste/fixture.py
+++ b/paste/fixture.py
@@ -221,6 +221,9 @@ class TestApp(object):
# @@: Should this be all non-strings?
if isinstance(params, (list, tuple, dict)):
params = urllib.urlencode(params)
+ if hasattr(params, 'items'):
+ # Some other multi-dict like format
+ params = urllib.urlencode(params.items())
if upload_files:
params = cgi.parse_qsl(params, keep_blank_values=True)
content_type, params = self.encode_multipart(
diff --git a/tests/test_fixture.py b/tests/test_fixture.py
index 576d375..310a332 100644
--- a/tests/test_fixture.py
+++ b/tests/test_fixture.py
@@ -12,4 +12,7 @@ def test_fixture():
res = app.delete('/')
assert (res.request.environ['REQUEST_METHOD'] ==
'DELETE')
-
+ class FakeDict(object):
+ def items(self):
+ return [('a', '10'), ('a', '20')]
+ res = app.post('/params', params=FakeDict())