import pytest

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


class TestPolymerizationContent:
    data = BaseRequest().api_load(path_setting.POLYMERIZATION_CONTENT)
    polymerizaiton_content_case, polymerizaiton_content_data = get_ids(data, "polymerization_content")
    @pytest.mark.parametrize("param", polymerizaiton_content_data, ids=polymerizaiton_content_case)

    def test_polymerization_content(self,param):
        r = polymerization_request().polymerization_content(param["tabtype"], param["category_polymer_id"], param["page"], param["tag_ids"], param["operation_id"], param["level"], param["version"])

        if r["error"] == 0:
            assert len(r["data"]["features"]) != param["assert"]
            # assert r["data"]["features"][0]["diary"]["tags"][0]["tag_id"] == param["operation_id"]
            print("品类聚合页-社区/视频列表接口已通哦")
        else:
            assert r["error"] == 99
            print("接口出错了")