mirror of
https://github.com/django/django.git
synced 2025-11-01 20:31:40 +00:00
Fixed #4968 -- Added assertRedirects handling for paths with GET data. Thanks for the patch, Ivan Sagalaev.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6031 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d09d1428f8
commit
5ad08583e1
5 changed files with 41 additions and 12 deletions
|
|
@ -86,6 +86,13 @@ class ClientTest(TestCase):
|
|||
|
||||
# Check that the response was a 302 (redirect)
|
||||
self.assertRedirects(response, '/test_client/get_view/')
|
||||
|
||||
def test_redirect_with_query(self):
|
||||
"GET a URL that redirects with given GET parameters"
|
||||
response = self.client.get('/test_client/redirect_view/', {'var': 'value'})
|
||||
|
||||
# Check if parameters are intact
|
||||
self.assertRedirects(response, '/test_client/get_view/?var=value')
|
||||
|
||||
def test_permanent_redirect(self):
|
||||
"GET a URL that redirects permanently elsewhere"
|
||||
|
|
@ -224,7 +231,7 @@ class ClientTest(TestCase):
|
|||
|
||||
# Get the page without logging in. Should result in 302.
|
||||
response = self.client.get('/test_client/login_protected_view/')
|
||||
self.assertRedirects(response, '/accounts/login/')
|
||||
self.assertRedirects(response, '/accounts/login/?next=/test_client/login_protected_view/')
|
||||
|
||||
# Log in
|
||||
self.client.login(username='testclient', password='password')
|
||||
|
|
@ -261,7 +268,7 @@ class ClientTest(TestCase):
|
|||
|
||||
# Request a page that requires a login
|
||||
response = self.client.get('/test_client/login_protected_view/')
|
||||
self.assertRedirects(response, '/accounts/login/')
|
||||
self.assertRedirects(response, '/accounts/login/?next=/test_client/login_protected_view/')
|
||||
|
||||
def test_session_modifying_view(self):
|
||||
"Request a page that modifies the session"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue