1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #21587 -- Added a warning for changing default of RedirectView.permanent.

This commit is contained in:
Berker Peksag
2014-11-21 18:55:58 +02:00
committed by Tim Graham
parent d43dd03ca3
commit 9a30acad8a
7 changed files with 135 additions and 21 deletions

View File

@@ -18,7 +18,7 @@ from django.http import HttpRequest, HttpResponseRedirect, HttpResponsePermanent
from django.shortcuts import redirect
from django.test import TestCase, override_settings
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning
from admin_scripts.tests import AdminScriptTestCase
@@ -309,8 +309,10 @@ class ResolverTests(unittest.TestCase):
class ReverseLazyTest(TestCase):
def test_redirect_with_lazy_reverse(self):
response = self.client.get('/redirect/')
self.assertRedirects(response, "/redirected_to/", status_code=301)
with warnings.catch_warnings():
warnings.simplefilter("ignore", RemovedInDjango19Warning)
response = self.client.get('/redirect/')
self.assertRedirects(response, "/redirected_to/", status_code=301)
def test_user_permission_with_lazy_reverse(self):
User.objects.create_user('alfred', 'alfred@example.com', password='testpw')