From 0a059b5fd5248c342c5f0c147ff89c9c38fcd03a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carles=20Barrobe=CC=81s?= Date: Thu, 19 Nov 2015 23:45:42 +0100 Subject: [PATCH 1/2] Bug in non-strict request --- abe/unittest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/abe/unittest.py b/abe/unittest.py index 6e49c03..80a65a9 100644 --- a/abe/unittest.py +++ b/abe/unittest.py @@ -144,8 +144,9 @@ def assert_matches_request(self, sample_request, wsgi_request, wsgi_request.META, sample_request['headers'] ) - if 'body' in sample_request and 'body' not in non_strict: - self.assert_data_equal(wsgi_request.POST, sample_request['body']) + if 'body' in sample_request: + self.assert_data_equal( + wsgi_request.POST, sample_request['body'], non_strict) def assert_matches_response(self, sample_response, wsgi_response, non_strict=None): From db1c556a1b1d0692deaed8bda605bf43cc4b48ec Mon Sep 17 00:00:00 2001 From: Alex Couper Date: Fri, 20 Nov 2015 09:34:19 +0100 Subject: [PATCH 2/2] Add test for non-strict post requets. --- tests/test_assertions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_assertions.py b/tests/test_assertions.py index 1dbd796..0059d84 100644 --- a/tests/test_assertions.py +++ b/tests/test_assertions.py @@ -166,6 +166,12 @@ def test_assertion_error_if_post_data_mismatch(self): self.sample_request, self.mock_wsgi_request ) + def test_matches_non_strict(self): + self.mock_wsgi_request.POST = {'name': 'Something else'} + self.assert_matches_request( + self.sample_request, self.mock_wsgi_request, non_strict=['name'] + ) + def _abe_wrap_response(response): abe_mock = AbeMock({