From 1b680ac5e613d424072189633f865b3319cceaa3 Mon Sep 17 00:00:00 2001
From: Ben Sturmfels <ben@sturm.com.au>
Date: Mon, 24 Aug 2015 20:47:33 +1000
Subject: [PATCH] trac#665: Upgrade to WebTest 2.0.18 and fix broken test
`test_csrf_cookie_set`.
Test was failing due to API change in WebTest around accessing cookies set in the test client. These are now in `test_app.cookies`.
While there are currently 48 other tests failing, I've verified that before and after this change that the same number fail. I've also checked that no other tests use the old API for accessing test client cookies.
I've pinned to version 2.0.18. My understanding is that it's generally a good idea to pin to a specific version where possible to avoid the "why has this suddenly broken" type bugs. This also seems appropriate since WebTest appears to be very stable.
---
mediagoblin/tests/test_csrf_middleware.py | 4 ++--
setup.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mediagoblin/tests/test_csrf_middleware.py b/mediagoblin/tests/test_csrf_middleware.py
index a272caf..4452112 100644
a
|
b
|
def test_csrf_cookie_set(test_app):
|
25 | 25 | |
26 | 26 | # assert that the mediagoblin nonce cookie has been set |
27 | 27 | assert 'Set-Cookie' in response.headers |
28 | | assert cookie_name in response.cookies_set |
| 28 | assert cookie_name in test_app.cookies |
29 | 29 | |
30 | 30 | # assert that we're also sending a vary header |
31 | 31 | assert response.headers.get('Vary', False) == 'Cookie' |
… |
… |
def test_csrf_cookie_set(test_app):
|
34 | 34 | # We need a fresh app for this test on webtest < 1.3.6. |
35 | 35 | # We do not understand why, but it fixes the tests. |
36 | 36 | # If we require webtest >= 1.3.6, we can switch to a non fresh app here. |
37 | | # |
| 37 | # |
38 | 38 | # ... this comment might be irrelevant post-pytest-fixtures, but I'm not |
39 | 39 | # removing it yet in case we move to module-level tests :) |
40 | 40 | # -- cwebber |
diff --git a/setup.py b/setup.py
index 68303f2..d96ed17 100644
a
|
b
|
install_requires = [
|
74 | 74 | 'kombu', |
75 | 75 | 'jinja2', |
76 | 76 | 'Babel>=1.3', |
77 | | 'webtest<2', |
| 77 | 'WebTest==2.0.18', |
78 | 78 | 'ConfigObj', |
79 | 79 | 'Markdown', |
80 | 80 | 'sqlalchemy<0.9.0, >0.8.0', |