summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_views
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2010-01-12 23:35:29 +0000
committerJannis Leidel <jannis@leidel.info>2010-01-12 23:35:29 +0000
commitc4470e5ced090075adbef36b98b051c5a53f7a2e (patch)
tree8c2de705b993140be3c0b8280ca35c48edb7265a /tests/regressiontests/admin_views
parenta2056919799e48f053fa16b65569fc1e8f57ebe1 (diff)
Make use of new ability to override admin add form templates and removed a litle bit of redundancy in the templates.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_views')
-rw-r--r--tests/regressiontests/admin_views/tests.py39
1 files changed, 21 insertions, 18 deletions
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index 7a20aaacd5..38d5dfe397 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -1795,27 +1795,30 @@ class IncompleteFormTest(TestCase):
fixtures = ['admin-views-users.xml']
def setUp(self):
- self.client.login(username='super', password='secret')
+ self.client.login(username='super', password='secret')
def tearDown(self):
- self.client.logout()
+ self.client.logout()
def test_user_creation(self):
- response = self.client.post('/test_admin/admin/auth/user/add/', {
- 'username': 'newuser',
- 'password1': 'newpassword',
- 'password2': 'newpassword',
- })
- new_user = User.objects.order_by('-id')[0]
- self.assertRedirects(response, '/test_admin/admin/auth/user/%s/' % new_user.pk)
- self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD)
+ response = self.client.post('/test_admin/admin/auth/user/add/', {
+ 'username': 'newuser',
+ 'password1': 'newpassword',
+ 'password2': 'newpassword',
+ '_continue': '1',
+ })
+ new_user = User.objects.order_by('-id')[0]
+ self.assertRedirects(response, '/test_admin/admin/auth/user/%s/' % new_user.pk)
+ self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD)
def test_password_mismatch(self):
- response = self.client.post('/test_admin/admin/auth/user/add/', {
- 'username': 'newuser',
- 'password1': 'newpassword',
- 'password2': 'mismatch',
- })
- self.assertEquals(response.status_code, 200)
- self.assert_('password' not in response.context['form'].errors)
- self.assertFormError(response, 'form', 'password2', ["The two password fields didn't match."])
+ response = self.client.post('/test_admin/admin/auth/user/add/', {
+ 'username': 'newuser',
+ 'password1': 'newpassword',
+ 'password2': 'mismatch',
+ })
+ self.assertEquals(response.status_code, 200)
+ adminform = response.context['adminform']
+ self.assert_('password' not in adminform.form.errors)
+ self.assertEquals(adminform.form.errors['password2'],
+ [u"The two password fields didn't match."])