import pytest

import path_setting
from all_backend_api.visual_beauty_card import visual_beauty_card_request
from ids_list import get_ids
from in_common.base_request import BaseRequest

#次卡商品列表筛选器接口
class TestBeautyCardFilters:
    data = BaseRequest().api_load(path_setting.BEAUTYCARD_FILTERS)
    beautycard_filters_case, beautycard_filters_data = get_ids(data, "beautycard_filters")

    @pytest.mark.parametrize("param", beautycard_filters_data, ids=beautycard_filters_case)
    def test_beautycard_filters(self, param):
        r = visual_beauty_card_request().beautycard_filters(param["unit_id"], param["current_city_id"], param["version"])
        if param["unit_id"] == "20109":
            assert len(r["data"]) > param["assert_spu"]
            assert len(r["data"]["field"]) is not None
            assert len(r["data"]["areas"]) is not None
            assert len(r["data"]["order"]) is not None
        if param["unit_id"] == "20113":
            assert len(r["data"]) > param["assert_sku"]
            assert len(r["data"]["field"]) is not None
            assert len(r["data"]["areas"]) is not None
            assert len(r["data"]["order"]) is not None
