Skip to content

Request.POST comparison fails due to lists #16

Description

@alexcouper

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions