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 TestFavor:
    data = BaseRequest().api_load(path_setting.DIARY_FAVOR)
    diary_favor_case, diary_favor_data = get_ids(data, "diary_favor")

    @pytest.mark.parametrize("param", diary_favor_data, ids=diary_favor_case)
    def test_favor(self, param):
        r = diary_request().diary_isfavor()
        # print(r)
        if r["error"] == 0:
            assert r["message"] == param["assert"]
        if r["error"] == 1:
            assert r["message"] ==param["assert2"]

        r = diary_request().diary_cancelfavor()
        # print(r)
        if r["error"] == 0:
            assert r["message"] == param["assert3"]
        if r["error"] == 1:
            assert r["message"] == param["assert2"]










