#36859: SimpleTestCase.assertContains can't be called multiple times on a
streaming
response
-------------------------------------+-------------------------------------
Reporter: Baptiste Mispelon | Owner: Baptiste
| Mispelon
Type: Bug | Status: assigned
Component: Testing framework | Version: 6.0
Severity: Normal | Resolution:
Keywords: assertContains, | Triage Stage: Accepted
streaming |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Carlton Gibson):
I'm not sure about calling this a bug. It seems very much a new feature. —
The existing behaviour is long standing, and will be expected by anyone
who's used streaming responses over time. So, if we are going to change
it, it would merit a release note, etc.
> I'd argue that the test code shouldn't have to care about the nature of
the response...
Yeah. Gah. Streaming responses are their own thing. Our test probably
should know it's dealing with a streaming response, and perform extra
checks accordingly. Collecting the content into a variable and then
asserting on that, would be pretty standard.
But 🤷 — I don't have a particular objection if it doesn't break anything.
(Only commenting because I was CC'd.)
--
Ticket URL: <https://code.djangoproject.com/ticket/36859#comment:3>
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 view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019bbd6bd975-d9a33596-922d-4644-896c-271bb43682ff-000000%40eu-central-1.amazonses.com.