Assert that an error message is present

This commit is contained in:
Matt Westcott 2015-09-04 14:48:51 +01:00
parent 2d90d0dbf2
commit 07e37af3eb

View file

@ -96,6 +96,8 @@ class TestUserCreateView(TestCase, WagtailTestUtils):
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'wagtailusers/users/create.html')
self.assertTrue(response.context['form'].errors['password2'])
# Check that the user was not created
users = get_user_model().objects.filter(username='testuser')
self.assertEqual(users.count(), 0)