1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

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.
This commit is contained in:
Nicolas Delaby
2017-11-23 17:18:03 +01:00
committed by Tim Graham
parent 7a6fbf36b1
commit 746caf3ef8
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})