1
0
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 in 6e55e1d88a.

Backport of 746caf3ef8 from master
This commit is contained in:
Nicolas Delaby
2017-11-23 17:18:03 +01:00
committed by Tim Graham
parent aba31aa86b
commit ae4132a940
6 changed files with 21 additions and 8 deletions

View File

@@ -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})