def test_coupon_create_strong():
    log.step("验证优惠券价格=100时候接口逻辑正确")
    my_demo_api = CouponCreateApi(amount=0, name="jfkdjfdo")
    # my_demo_api.body.productCategoryRelationList = []
    my_demo_api.add_cate_relation(couponId='11111', parentCategoryName='3232')
    # for k in xxxx:
    # my_demo_api.add_cate_relation(**k)
    # my_demo_api.body.amount = 100
    my_demo_api.send_request()
    my_demo_api.check()
def test_coupon_create_time_v2(input={}, msg=None, code=200):
    log.step(msg)
    api_obj = CouponCreateApi(status=code, **input)
    return api_obj
def test_coupon_create_amount_v2(req_data={}, msg=None):
    log.step(msg)
    api_obj = CouponCreateApi(**req_data)
    return api_obj
def test_coupon_create_strong_amount_v2(req_data={}, msg=None, code=200):
    log.step(msg)
    api_obj = CouponCreateApi(status=code, **req_data)
    # api_obj.send_request()
    # api_obj.check()
    return api_obj
def test_coupon_create_check_amount_success(req_data={}, msg=None, code=200):
    log.step(msg)
    api_obj = CouponCreateApi(status=code, **req_data)
    return api_obj
def test_coupon_compare_other_api(input={}, msg=None):
    log.step(msg)
    api_obj = CouponCreateApi(**input)
    return api_obj
def test_combo_coupon_type_and_user_type(user_type_all, coupon_type_all):
    log.step("验证用户类型和优惠券类型组合情况创建优惠券成功")
    api_obj = CouponCreateApi(type=coupon_type_all, useType=user_type_all)
    return api_obj
# 外部check,主要用于接口对比的校验方式


def check(api_obj, compare_obj):
    fill_in_obj_from_obj(compare_obj.body, api_obj.body)
    # compare_obj.host = "http://test-xxxxx/"  # 不用看这个调不通。。。只是一个例子
    compare_obj.send_request()
    from common.ObjAssert import ObjAssert
    assert_obj = ObjAssert()
    assert_obj.is_equal(exp_obj=compare_obj.resp, act_obj=api_obj.resp)


@parameterized(
    [param(req_data=dict(amount=100.99),
           msg="验证amount=100.99时创建优惠券成功")])  # 对服务对比检查
@case_model(compare_hook=check, compare_obj=CouponCreateApi())
def test_coupon_compare_other_api(input={}, msg=None):
    log.step(msg)
    api_obj = CouponCreateApi(**input)
    return api_obj


def test_coupon_create_strong():
    log.step("验证优惠券价格=100时候接口逻辑正确")
    my_demo_api = CouponCreateApi(amount=0, name="jfkdjfdo")
    # my_demo_api.body.productCategoryRelationList = []
    my_demo_api.add_cate_relation(couponId='11111', parentCategoryName='3232')
    # for k in xxxx:
    # my_demo_api.add_cate_relation(**k)
    # my_demo_api.body.amount = 100
    my_demo_api.send_request()