#18707: Test client doesn't allow testing 500 responses content
-----------------------------------+------------------------------------
Reporter: ricardokirkner@… | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Comment (by Stephane "Twidi" Angel):
By the way I found a solution. I need this in a whole test case so:
{{{#!python
from unittest.mock import patch
from django.test import TestCase
class MyTestCase(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.patched_signal =
patch('django.core.signals.got_request_exception.connect')
cls.patched_signal.start()
@classmethod
def tearDownClass(cls):
cls.patched_signal.stop()
super().tearDownClass()
}}}
With this the signal is not connected so the "problematic" code is not
called.
Note: this also works by patching
`django.test.client.Client.store_exc_info`
--
Ticket URL: <https://code.djangoproject.com/ticket/18707#comment:12>
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/082.0ecfe935b28af78097bcbb1e120eafcf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.