def test_passwords_diff(self): self.data['password1'] = 'qwe' form = SimpleRegistrationForm(self.data) self.assertTrue(form.is_bound) self.assertFalse(form.is_valid()) self.assertEqual([_(u'The password fields did not match'), ], form.errors['__all__'])
def test_existing_email(self): self.data['email'] = self.user.email form = SimpleRegistrationForm(self.data) self.assertTrue(form.is_bound) self.assertFalse(form.is_valid()) self.assertEqual([_(u'This email already registered'), ], form['email'].errors)
def test_lost_lastname(self): self.data['last_name'] = None form = SimpleRegistrationForm(self.data) self.assertTrue(form.is_bound) self.assertFalse(form.is_valid()) self.assertEqual([_(u'This field is required.'), ], form['last_name'].errors)
def test_empty_lastname(self): self.data['last_name'] = ' ' form = SimpleRegistrationForm(self.data) self.assertTrue(form.is_bound) self.assertFalse(form.is_valid()) self.assertEqual([_(u'You must provide a last name!'), ], form['last_name'].errors)
def test_user_creation(self): form = SimpleRegistrationForm(self.data) self.assertTrue(form.is_bound) self.assertTrue(form.is_valid())