示例#1
0
    def test_userCreate_whenValidEmailAndPass_shouldCreateUser(self):
        user = RecipesUser(
            email='*****@*****.**',
            password='******',
        )

        user.full_clean()
        user.save()

        self.assertIsNotNone(user)
示例#2
0
    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)