예제 #1
0
 def test_no_commit(self):
     form = UserCreationForm(data=self.testdata)
     user = form.save(commit=False)
     self.assertIsNone(user.pk)
예제 #2
0
 def test_clean_password2_passwords_do_not_match(self):
     self.testdata['password2'] = 'test2345'
     form = UserCreationForm(data=self.testdata)
     self.assertFalse(form.is_valid())
     self.assertEqual(len(form.errors['password2']), 1)
     self.assertEqual(form.errors['password2'], [PASSWORD_MISMATCH_ERROR])
예제 #3
0
 def test_save_hash_password(self):
     form = UserCreationForm(data=self.testdata)
     user = form.save()
     self.assertIsNotNone(user.pk)
     self.assertTrue(user.check_password('test1234'))
예제 #4
0
 def test_clean_password2_passwords_match(self):
     form = UserCreationForm(data=self.testdata)
     self.assertTrue(form.is_valid(), str(form.errors))
     self.assertEqual(form.cleaned_data['password2'], 'test1234')