Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#32154 closed Bug (needsinfo)

Test client POSTs unset data as False

Reported by: Aristotelis Mikropoulos Owned by: nobody
Component: Testing framework Version: 3.1
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

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.

Change History (3)

comment:1 by Carlton Gibson, 4 years ago

Resolution: needsinfo
Status: newclosed

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.

comment:2 by Aristotelis Mikropoulos, 4 years ago

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.

comment:3 by Carlton Gibson, 4 years ago

Thanks for the confirmation. 👍

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