def test_registered_email(self): """ Test that an email registered to another user is returned as False. i.e. It is NOT available for another user to use. """ with self.assertRaises(ValidationError): validate_email_availability('*****@*****.**')
def clean_email(self): email = self.cleaned_data['email'] if email != self.user.email: validate_email_availability(email) return email
def test_unregistered_email(self): """ Test that an email not registered to another user is returned as True. i.e. It is available for another user to use. """ unregistered = validate_email_availability( '*****@*****.**') self.assertTrue(unregistered)