import pytest

from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.diary_request import diary_request


class TestDiaryService:
    data = BaseRequest().api_load(path_setting.DIARY_SERVICE)
    diary_service_case, diary_service_data = get_ids(data, "diary_service")

    @pytest.mark.fail
    @pytest.mark.parametrize("param",diary_service_data,ids=diary_service_case)
    def test_diary_service(self,param):
        # print(2)
        r = diary_request().diary_service(param["diary_id"],param["service_id"])
        # print(r)
        print("返回结果", r)
        if r["error"] == 0:
            assert r["error"] == param["assert"]
            # 先判断有没有日记，然后判断日记本里面需要的那些字段，如点赞字段，日记总数等，不传值，传空值

        if r["error"] == 1:
            assert r["error"] == param["assert"]




