Exemple #1
0
 def test_password_same_length_as_limit(self):
     valid = dict(self.user_data)
     valid_password = '******' * settings.MIN_PASSWORD_LENGTH
     valid['password1'] = valid_password
     valid['password2'] = valid_password
     form = account_forms.UserCreationForm(data=valid)
     self.assertTrue(form.is_valid())
Exemple #2
0
 def test_password_too_short(self):
     invalid = dict(self.user_data)
     invalid['password1'] = 'short'
     invalid['password2'] = 'short'
     form = account_forms.UserCreationForm(data=invalid)
     self.assertFalse(form.is_valid())
     self.assertIn('password2', form.errors.keys())
Exemple #3
0
 def test_using_already_registered_email(self):
     user = UserFactory()
     invalid = dict(self.user_data)
     invalid['email'] = user.email
     form = account_forms.UserCreationForm(data=invalid)
     self.assertFalse(form.is_valid())
     self.assertIn('email', form.errors.keys())
Exemple #4
0
 def test_form_valid(self):
     form = account_forms.UserCreationForm(data=self.user_data)
     self.assertTrue(form.is_valid())
Exemple #5
0
 def test_form_invalid_without_name(self):
     invalid = dict(self.user_data)
     del (invalid['name'])
     form = account_forms.UserCreationForm(data=invalid)
     self.assertFalse(form.is_valid())
     self.assertIn('name', form.errors.keys())
Exemple #6
0
 def test_form_invalid_passwords_mismatch(self):
     invalid = dict(self.user_data)
     invalid['password2'] = 'wrongpassword'
     form = account_forms.UserCreationForm(data=invalid)
     self.assertFalse(form.is_valid())
     self.assertIn('password2', form.errors.keys())
Exemple #7
0
 def test_invalid_email(self):
     invalid = dict(self.user_data)
     invalid['email'] = 'wrong.wrong.com'
     form = account_forms.UserCreationForm(data=invalid)
     self.assertFalse(form.is_valid())
     self.assertIn('email', form.errors.keys())