def test_userCreate_whenValidEmailAndPass_shouldCreateUser(self): user = RecipesUser( email='*****@*****.**', password='******', ) user.full_clean() user.save() self.assertIsNotNone(user)
def test_userCreate_whenInvalidEmail_shouldRaiseError(self): user = RecipesUser( email='invalid', password='******', ) try: user.full_clean() user.save() self.fail() except ValidationError as ex: self.assertIsNotNone(ex)