import pytest

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


class TestReply:
    data = BaseRequest().api_load(path_setting.DIARY_COMMON_REPLY)
    diary_common_reply_case, diary_common_reply_data = get_ids(data, "common_reply")

    @pytest.mark.parametrize("param", diary_common_reply_data, ids=diary_common_reply_case)
    def test_reply(self, param):
        # 日记贴的评论列表
        r = common_request().diary_common_reply(param["id"], param["type"],param["data_type"],param["offset"],param["start_num"])
        # print(r)
        if r["error"] == 0:
            assert r["error"] == param["assert1"]
            # 先判断有没有评论，然后判断里面需要的那些字段，如点赞字段，评论总数等，不传值，传空值
            if r["data"]["reply_data"]:
                assert r["data"]["reply_data"][0]["user"]["user_portrait"] is not None and r["data"]["reply_data"][0]["user"]["user_portrait"] is not ""  # 用户头像






