def test_valid_form(self): u = UserFactory(email='*****@*****.**') form = EmailConfirmForm({'email': '*****@*****.**'}) self.assertTrue(form.is_valid()) # Test get_user self.assertEqual(form.get_user(), u)
def test_invalid_form(self): form = EmailConfirmForm({'email': '*****@*****.**'}) self.assertFalse(form.is_valid()) self.assertEqual(form.errors['email'], [str(form.error_messages.get('not_user'))])