1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

newforms-admin: Merged to [6050]

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6051 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2007-09-05 20:01:24 +00:00
parent bd01c6ee57
commit 976acdc774
28 changed files with 433 additions and 178 deletions

View File

@@ -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,10 +231,11 @@ 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')
login = self.client.login(username='testclient', password='password')
self.assertTrue(login, 'Could not log in')
# Request a page that requires a login
response = self.client.get('/test_client/login_protected_view/')
@@ -261,7 +269,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"