Пример #1
0
 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__'])
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
 def test_user_creation(self):
     form = SimpleRegistrationForm(self.data)
     self.assertTrue(form.is_bound)
     self.assertTrue(form.is_valid())