mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #25163 -- Fixed exception handling in nested test client requests.
This commit is contained in:
@@ -11,6 +11,7 @@ from django.http import (
|
||||
)
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template import Context, Template
|
||||
from django.test import Client
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.six.moves.urllib.parse import urlencode
|
||||
|
||||
@@ -309,5 +310,15 @@ def mass_mail_sending_view(request):
|
||||
return HttpResponse("Mail sent")
|
||||
|
||||
|
||||
def nesting_exception_view(request):
|
||||
"""
|
||||
A view that uses a nested client to call another view and then raises an
|
||||
exception.
|
||||
"""
|
||||
client = Client()
|
||||
client.get('/get_view/')
|
||||
raise Exception('exception message')
|
||||
|
||||
|
||||
def django_project_redirect(request):
|
||||
return HttpResponseRedirect('https://www.djangoproject.com/')
|
||||
|
||||
Reference in New Issue
Block a user