Opened 6 years ago

Last modified 6 years ago

#30089 closed Bug

TestClient doesn't accept data with duplicate keys (SELECT multiple) — at Initial Version

Reported by: Adam Gilman Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When constructing tests for forms with SELECT elements which allow multiple item selection, the test client doesn't accept multiple selections due to the fact it uses dict internally and results in a squashed single key

Failing test

    def test_post_multi_select(self):
        "POST SELECT multiple data to a view"
        post_data = QueryDict(mutable=True)
        post_data.update({'value':37})
        post_data.update({'value':37})
        response = self.client.post('/post_view/', post_data)

        # Check some response details
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context['data'], ['37', '38'])
        self.assertEqual(response.templates[0].name, 'POST Template')
        self.assertContains(response, 'Data received')

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top