diff options
-rw-r--r-- | docs/news.txt | 5 | ||||
-rw-r--r-- | paste/fixture.py | 3 | ||||
-rw-r--r-- | tests/test_fixture.py | 10 |
3 files changed, 16 insertions, 2 deletions
diff --git a/docs/news.txt b/docs/news.txt index c3a8b83..b523abb 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -29,7 +29,10 @@ svn trunk * Exceptions with unicode messages don't cause the collector to fail. * Sometimes ErrorMiddleware would not call start_response properly; - this is fixed (from inducer). + this is fixed (from Andreas Kloecker). + +* ``paste.fixture.TestApp`` can store multiple cookie values + (previously only one cookie was stored; from Andrey Lebedev) 1.6.1 ----- diff --git a/paste/fixture.py b/paste/fixture.py index 33c70b9..8c569f7 100644 --- a/paste/fixture.py +++ b/paste/fixture.py @@ -372,7 +372,8 @@ class TestApp(object): c = BaseCookie() for name, value in self.cookies.items(): c[name] = value - req.environ['HTTP_COOKIE'] = str(c).split(': ', 1)[1] + hc = '; '.join(['='.join([m.key, m.value]) for m in c.values()]) + req.environ['HTTP_COOKIE'] = hc req.environ['paste.testing'] = True req.environ['paste.testing_variables'] = {} app = lint.middleware(self.app) diff --git a/tests/test_fixture.py b/tests/test_fixture.py index 310a332..ba56488 100644 --- a/tests/test_fixture.py +++ b/tests/test_fixture.py @@ -16,3 +16,13 @@ def test_fixture(): def items(self): return [('a', '10'), ('a', '20')] res = app.post('/params', params=FakeDict()) + + # test multiple cookies in one request + app.cookies['one'] = 'first'; + app.cookies['two'] = 'second'; + app.cookies['three'] = ''; + res = app.get('/') + hc = res.request.environ['HTTP_COOKIE'].split('; '); + assert ('one=first' in hc) + assert ('two=second' in hc) + assert ('three=' in hc) |