Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request.POST comparison fails due to lists #16

Open
alexcouper opened this issue Aug 13, 2016 · 0 comments
Open

Request.POST comparison fails due to lists #16

alexcouper opened this issue Aug 13, 2016 · 0 comments

Comments

@alexcouper
Copy link
Collaborator

Reproduce:

  1. Perform a POST with some list data:
{'foo': ['1', '2']}
  1. Use assert_matches_request in your test
  2. See that it fails on:
nose.proxy.AssertionError: '2' != "['1', '2']"
- 2
+ ['1', '2']

Why?

self.assert_data_equal(wsgi_request.POST, sample_request['body'])
The comparison fails due to the fact that request['foo'] is '2' (as opposed to request.getlist('foo') which is ['1', '2'])

Some cleverness in assert_matches_request may need to happen to create an accurate dict based on what the sample request indicates is in the payload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant