import pytest

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


class TestDetail:
    data = BaseRequest().api_load(path_setting.DETAIL)
    detail_case, detail_data = get_ids(data, "detail")

    @pytest.mark.parametrize("param",detail_data,ids=detail_case)
    def test_detail(self,param):
        # print(param["vfc_code"])
        r = answer_request().detail(param["current_city_id"], param["answer_id"])
        # if r["error"] == 0:
        #     assert r["data"]["account_phone"] == param["assert"]
        # if r["error"] == 1:
        #     assert r["message"] == param["assert"]
        assert r["data"]["is_favored"] is not None and r["data"]["is_favored"] is not ""
        assert r["data"]["comment_num"] is not None and r["data"]["comment_num"] is not ""
        assert r["data"]["time"] is not None and r["data"]["time"] is not ""
        assert r["data"]["vote_num"] is not None and r["data"]["vote_num"] is not ""
        assert r["data"]["is_following"] is not None and r["data"]["is_following"] is not ""
        assert r["data"]["is_author"] is not None and r["data"]["is_author"] is not ""
        assert r["data"]["is_voted"] is not None and r["data"]["is_voted"] is not ""
        assert r["data"]["view_num"] is not None and r["data"]["view_num"] is not ""
        assert r["data"]["answer_id"] is not None and r["data"]["answer_id"] is not ""



