Skip to content

Commit 2963d43

Browse files
committed
Merge pull request #15 from apibyexample/carles/non-strict-request-bug
Bug in non-strict request
2 parents e4da4d0 + db1c556 commit 2963d43

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

abe/unittest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ def assert_matches_request(self, sample_request, wsgi_request,
144144
wsgi_request.META, sample_request['headers']
145145
)
146146

147-
if 'body' in sample_request and 'body' not in non_strict:
148-
self.assert_data_equal(wsgi_request.POST, sample_request['body'])
147+
if 'body' in sample_request:
148+
self.assert_data_equal(
149+
wsgi_request.POST, sample_request['body'], non_strict)
149150

150151
def assert_matches_response(self, sample_response, wsgi_response,
151152
non_strict=None):

tests/test_assertions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ def test_assertion_error_if_post_data_mismatch(self):
166166
self.sample_request, self.mock_wsgi_request
167167
)
168168

169+
def test_matches_non_strict(self):
170+
self.mock_wsgi_request.POST = {'name': 'Something else'}
171+
self.assert_matches_request(
172+
self.sample_request, self.mock_wsgi_request, non_strict=['name']
173+
)
174+
169175

170176
def _abe_wrap_response(response):
171177
abe_mock = AbeMock({

0 commit comments

Comments
 (0)