mirror of
https://github.com/django/django.git
synced 2025-10-27 15:46:10 +00:00
[2.0.x] Fixed #28837 -- Fixed test client crash if an exception with more than one arg is raised.
Also removed usage of the problematic pattern elsewhere. Regression in6e55e1d88a. Backport of746caf3ef8from master
This commit is contained in:
committed by
Tim Graham
parent
aba31aa86b
commit
ae4132a940
@@ -29,7 +29,7 @@ from django.test import (
|
||||
)
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from .views import get_view, post_view, trace_view
|
||||
from .views import TwoArgException, get_view, post_view, trace_view
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='test_client.urls')
|
||||
@@ -713,6 +713,11 @@ class ClientTest(TestCase):
|
||||
with self.assertRaisesMessage(Exception, 'exception message'):
|
||||
self.client.get('/nesting_exception_view/')
|
||||
|
||||
def test_response_raises_multi_arg_exception(self):
|
||||
"""A request may raise an exception with more than one required arg."""
|
||||
with self.assertRaises(TwoArgException):
|
||||
self.client.get('/two_arg_exception/')
|
||||
|
||||
def test_uploading_temp_file(self):
|
||||
with tempfile.TemporaryFile() as test_file:
|
||||
response = self.client.post('/upload_view/', data={'temp_file': test_file})
|
||||
|
||||
Reference in New Issue
Block a user