[Django] #32154: Test client POSTs unset data as False

18 views
Skip to first unread message

Django

unread,
Oct 28, 2020, 4:54:21 PM10/28/20
to django-...@googlegroups.com
#32154: Test client POSTs unset data as False
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
Aristotelis Mikropoulos |
Type: Bug | Status: new
Component: Testing | Version: 3.1
framework |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
In a test case, calling self.client.post(url) with no data to an empty
(vanilla) CreateView of a dummy model sends boolean fields as False. That
is, if this model has a single field foo =
models.BooleanField(default=True) it is incorrectly created with a False
foo. Trying the same with an external client (such as cURL) without
declaring any POST data correctly puts a True foo in the newly created row
in the database.

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

Django

unread,
Oct 29, 2020, 6:33:26 AM10/29/20
to django-...@googlegroups.com
#32154: Test client POSTs unset data as False
-------------------------------------+-------------------------------------
Reporter: Aristotelis | Owner: nobody
Mikropoulos |
Type: Bug | Status: closed
Component: Testing framework | Version: 3.1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* status: new => closed
* resolution: => needsinfo


Comment:

Hiya. Can I ask you to put together a simple example please, including the
test case, and the comparison cURL command?

There's too much that could be going on to know exactly where you think
the issue could be. e.g. if you're going via a CheckboxInput a missing
value leading to False is expected, which then makes the comparison with
cURL interesting. (And so on...)

Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/32154#comment:1>

Django

unread,
Oct 29, 2020, 10:40:55 AM10/29/20
to django-...@googlegroups.com
#32154: Test client POSTs unset data as False
-------------------------------------+-------------------------------------
Reporter: Aristotelis | Owner: nobody
Mikropoulos |
Type: Bug | Status: closed
Component: Testing framework | Version: 3.1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Aristotelis Mikropoulos):

I found out this happens because the default way the test client sends
data is as multipart data. I guess that concludes the issue. Thanks for
your time.

--
Ticket URL: <https://code.djangoproject.com/ticket/32154#comment:2>

Django

unread,
Oct 29, 2020, 11:01:57 AM10/29/20
to django-...@googlegroups.com
#32154: Test client POSTs unset data as False
-------------------------------------+-------------------------------------
Reporter: Aristotelis | Owner: nobody
Mikropoulos |
Type: Bug | Status: closed
Component: Testing framework | Version: 3.1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

Thanks for the confirmation. 👍

--
Ticket URL: <https://code.djangoproject.com/ticket/32154#comment:3>

Reply all
Reply to author
Forward
0 new messages