import pytest

import path_setting
from all_om_api.beautycard_request import beautycard_request
from ids_list import get_ids
from in_common.base_request import BaseRequest

#更美次卡-按次卡spu_id导入，导入校验
class TestCheckSpuIds:
    data = BaseRequest().api_load(path_setting.CHECK_SPU_IDS)
    check_spu_ids_case, check_spu_ids_data = get_ids(data, "check_spu_ids")

    @pytest.mark.parametrize("param",check_spu_ids_data,ids=check_spu_ids_case)
    def test_check_spu_ids(self,param):
        r = beautycard_request().check_spu_ids(param["spu_ids"])
        if r["code"] == 0:
            if r["data"][0]["status"] == 1:
                print("成功导入次卡")
                assert r["data"][0]["reason"] == param["assert"]
            else:
                print("次卡不能成功导入")
                assert r["data"][0]["reason"] == param["assert"]
        if r["code"] == 1:
            print("接口有误")