Permalink
Browse files

Updated to test_client_regress to use RedirectView instead of depreca…

…ted redirect_to.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15991 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
freakboy3742 committed Apr 2, 2011
1 parent 4c46880 commit ae5f3e74187c558accaaee7a0c8d6b467b0a0fc2
@@ -3,6 +3,7 @@
Regression tests for the Test Client, especially the customized assertions.
"""
import os
+import warnings
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
@@ -883,6 +884,14 @@ class ResponseTemplateDeprecationTests(TestCase):
Response.template still works backwards-compatibly, but with pending deprecation warning. Refs #12226.
"""
+ def setUp(self):
+ self.save_warnings_state()
+ warnings.filterwarnings('ignore', category=DeprecationWarning,
+ module='django.test.client')
+
+ def tearDown(self):
+ self.restore_warnings_state()
+
def test_response_template_data(self):
response = self.client.get("/test_client_regress/request_data/", data={'foo':'whiz'})
self.assertEqual(response.template.__class__, Template)
@@ -1,5 +1,5 @@
from django.conf.urls.defaults import *
-from django.views.generic.simple import redirect_to
+from django.views.generic import RedirectView
import views
urlpatterns = patterns('',
@@ -10,22 +10,22 @@
(r'^request_data_extended/$', views.request_data, {'template':'extended.html', 'data':'bacon'}),
url(r'^arg_view/(?P<name>.+)/$', views.view_with_argument, name='arg_view'),
(r'^login_protected_redirect_view/$', views.login_protected_redirect_view),
- (r'^redirects/$', redirect_to, {'url': '/test_client_regress/redirects/further/'}),
- (r'^redirects/further/$', redirect_to, {'url': '/test_client_regress/redirects/further/more/'}),
- (r'^redirects/further/more/$', redirect_to, {'url': '/test_client_regress/no_template_view/'}),
- (r'^redirect_to_non_existent_view/$', redirect_to, {'url': '/test_client_regress/non_existent_view/'}),
- (r'^redirect_to_non_existent_view2/$', redirect_to, {'url': '/test_client_regress/redirect_to_non_existent_view/'}),
- (r'^redirect_to_self/$', redirect_to, {'url': '/test_client_regress/redirect_to_self/'}),
- (r'^circular_redirect_1/$', redirect_to, {'url': '/test_client_regress/circular_redirect_2/'}),
- (r'^circular_redirect_2/$', redirect_to, {'url': '/test_client_regress/circular_redirect_3/'}),
- (r'^circular_redirect_3/$', redirect_to, {'url': '/test_client_regress/circular_redirect_1/'}),
+ (r'^redirects/$', RedirectView.as_view(url='/test_client_regress/redirects/further/')),
+ (r'^redirects/further/$', RedirectView.as_view(url='/test_client_regress/redirects/further/more/')),
+ (r'^redirects/further/more/$', RedirectView.as_view(url='/test_client_regress/no_template_view/')),
+ (r'^redirect_to_non_existent_view/$', RedirectView.as_view(url='/test_client_regress/non_existent_view/')),
+ (r'^redirect_to_non_existent_view2/$', RedirectView.as_view(url='/test_client_regress/redirect_to_non_existent_view/')),
+ (r'^redirect_to_self/$', RedirectView.as_view(url='/test_client_regress/redirect_to_self/')),
+ (r'^circular_redirect_1/$', RedirectView.as_view(url='/test_client_regress/circular_redirect_2/')),
+ (r'^circular_redirect_2/$', RedirectView.as_view(url='/test_client_regress/circular_redirect_3/')),
+ (r'^circular_redirect_3/$', RedirectView.as_view(url='/test_client_regress/circular_redirect_1/')),
(r'^set_session/$', views.set_session_view),
(r'^check_session/$', views.check_session_view),
(r'^request_methods/$', views.request_methods_view),
(r'^check_unicode/$', views.return_unicode),
(r'^parse_unicode_json/$', views.return_json_file),
(r'^check_headers/$', views.check_headers),
- (r'^check_headers_redirect/$', redirect_to, {'url': '/test_client_regress/check_headers/'}),
+ (r'^check_headers_redirect/$', RedirectView.as_view(url='/test_client_regress/check_headers/')),
(r'^raw_post_data/$', views.raw_post_data),
(r'^request_context_view/$', views.request_context_view),
)

0 comments on commit ae5f3e7

Please sign in to comment.