示例#1
0
    def test_get_user_by_email(self, db):
        """
        This function contains the code to test the
        user service tha allows to retetrive the user having the email
        :param db: database session
        """
        json = Utils.get_json_about_new_user()
        user = UserService.create_user(db, json)
        assert user is not None
        assert user.role_id is 3

        assert UserService.get_user_by_email(db, user.email).id == user.id

        is_delete = UserService.delete_user(db, user.id)
        assert is_delete is True
示例#2
0
    def test_user_delete_ok(self, db):
        """
        This function contains the code to test the
        User services about the login, and I will aspect a good result.
        :param db: database session
        """
        json = Utils.get_json_about_new_user()
        user = UserService.create_user(db, json)
        assert user is not None
        assert user.role_id is 3
        user = UserService.user_login(db, user.email, json["password"])
        is_delete = UserService.delete_user(db, user.id)
        assert is_delete is True

        user = Utils.get_user_on_db_with_email(db, user.email)
        assert user is None