import pytest

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


class TestDiaryIsfavor:
    data = BaseRequest().api_load(path_setting.DIARY_ISFAVOR)
    diary_isfavor_case, diary_isfavor_data = get_ids(data, "diary_isfavor")

    @pytest.mark.parametrize("param", diary_isfavor_data, ids=diary_isfavor_case)
    def test_diary_isfavor(self, param):
        r = diary_isfavor_request().diary_isfavor()
        # print(r)
        if r["error"] == 0:
            assert r["message"] == param["assert"]
        if r["error"] == 1:
            assert r["message"] ==param["assert2"]


        #     收藏之后取消收藏
        # r1 = diary_isfavor_request().diary_cancelfavor()
        # if r["error"] == 0:
        #     assert r["error"] == param["assert"]






