#30089: TestClient doesn't accept data with duplicate keys (SELECT multiple)
-----------------------------------+--------------------------------------
     Reporter:  Adam Gilman        |                    Owner:  nobody
         Type:  Uncategorized      |                   Status:  new
    Component:  Testing framework  |                  Version:  2.1
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------
Description changed by Adam Gilman:

Old 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
>
> {{{#!python
>
>     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')
>
> }}}

New 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

 {{{#!python
 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':38})
         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')
 }}}
 *updated

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30089#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.052e3acf01ff7b49323e79557c6295c9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to