# NOTE: Generated By HttpRunner v3.1.4
# FROM: reverseOrder_query.har

"""
currentPage integer($int64) (query) 当前页数
 pageSize integer($int64) (query) 每页记录数
 qp-bg-eq string (query)
qp-createTime-eq string (query) 创建时间
 qp-createUserId-eq string (query)	 创建者ID
 qp-createUserName-eq string (query) 创建者姓名
 qp-detail-eq string (query) 标签描述
 qp-failureTime-eq string (query) 失效时间
 qp-groupId-eq string (query) 组id
 qp-labelUrl-eq string (query) 标签图片链接
 qp-modifyTime-eq string (query) 最新修改时间
 qp-modifyUserId-eq string (query) 最新修改者ID
 qp-modifyUserName-eq string (query) 最新修改者姓名
 qp-name-eq string (query) 标签名称
 qp-startTime-eq string (query) 开始时间
 qp-status-eq string (query) 状态 1：启动 0：关闭
 qp-type-eq string (query) 标签类型
 qp-weight-eq string (query) 标签长度
 sorter string (query) 排序条件 desc-字段名或者asc-字段名
 sso_sessionid string (header) sessionid
x-tenant-id * string (header) tenant Default value : 2
"""

from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase, Parameters
import pytest
from testcases.api.business.business_login_test import TestCaseBusinessLogin as Login


class TestCaseLabelLabelGetLabelLabelList(HttpRunner):

    @pytest.mark.parametrize(
        "param",
        Parameters({
            "business_userName-business_password-business_verifyCode-business_regType": "${parameterize(common.csv)}",
            "currentPage-pageSize-qp_bg_eq-qp_createTime_eq-qp_createUserId_eq-qp_createUserName_eq-qp_detail_eq-qp_failureTime_eq-qp_groupId_eq-qp_labelUrl_eq-qp_modifyTime_eq-qp_modifyUserId_eq-qp_name_eq-qp_modifyUserName_eq-qp_startTime_eq-qp_status_eq-qp_type_eq-qp_weight_eq-sorter": "${parameterize(testcases/api/business/labelLabel/labelLabel_getLabelLabelList.csv)}"
        })
    )
    def test_start(self, param) -> "HttpRunner":
        super().test_start(param)

    config = (
        Config("计算购物车中选中商品的价格")
        .base_url("${get_base_url()}")
        .variables(**{
            "x_tenant_id": "2",  # tenant Default value : 2     必填选项  header部分
        })
        .export(*["sessionId", "token", "employeeName", "employeeId", "accountName", "accountId", "accountCode"])
        .verify(False)
    )

    teststeps = [
        Step(
            RunTestCase("商家后台登录")
            .call(Login)
            .export(*["sessionId", "token", "employeeName", "employeeId", "accountName", "accountId", "accountCode"])
        ),
        Step(
            RunRequest("查询一系列资源对象，也就是列表")
            .get("/business/api/labelLabel/getLabelLabelList")
            .with_params(
                **{
                    "currentPage": "$currentPage",
                    "pageSize": "$pageSize",
                    "qp-bg-eq": "$qp_bg_eq",
                    "qp-createTime-eq": "$qp_createTime_eq",
                    "qp-createUserId-eq": "$qp_createUserId_eq",
                    "qp-createUserName-eq": "$qp_createUserName_eq",
                    "qp-detail-eq": "$qp_detail_eq",
                    "qp-failureTime-eq": "$qp_failureTime_eq",
                    "qp-groupId-eq": "$qp_groupId_eq",
                    "qp-labelUrl-eq": "$qp_labelUrl_eq",
                    "qp-modifyTime-eq": "$qp_modifyTime_eq",
                    "qp-modifyUserId-eq": "$qp_modifyUserId_eq",
                    "qp-name-eq": "$qp_name_eq",
                    "qp-modifyUserName-eq": "$qp_modifyUserName_eq",
                    "qp-startTime-eq": "$qp_startTime_eq",
                    "qp-status-eq": "$qp_status_eq",
                    "qp-type-eq": "$qp_type_eq",
                    "qp-weight-eq": "$qp_weight_eq",
                    "sorter": "$sorter"
                }
            )
            .with_headers(
                **{
                    "x-tenant-id": "$x_tenant_id",
                    "sso_sessionid": "$sessionId",
                }
            )
            .validate()
            .assert_equal("status_code", 200)
            .assert_equal('headers."Content-Type"', "application/json;charset=UTF-8")
            .assert_equal("body.code", "000000")
            .assert_equal("body.msg", "Success")
        ),
    ]


if __name__ == "__main__":
    TestCaseReverseorderQuery().test_start()
