# NOTE: Generated By HttpRunner v3.1.4
# FROM: 查看全部待评价订单
"""
@author :springfall

"""

from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase, Parameters
import pytest
from testcases.login_test.login_test import TestCaseLogin as Login

class TestCaseSearchEvaluated(HttpRunner):

    @pytest.mark.parametrize(
        'param',
        Parameters(
            {
                "phoneNumber-verifyCode": "${parameterize(common.csv)}",
            }
        ),
    )
    def test_start(self, param):
        super().test_start(param)

    config = (
        Config("登录操作 ")
        .base_url("${get_base_url()}")
        .export(*['sessionId', 'token', 'accountCode', 'personId', "name", "nickname", "username", "phone", "memberCode", "userCode", "account_id", "storeCode", "platformPricing", "salePrice", "itemCode", "skuCode", "orderIdOut", "orderNo"])
        .verify(False)
    )

    teststeps = [
        Step(
            RunTestCase("登录")
            .call(Login)
            .export(*['sessionId', 'token', 'accountCode', 'personId', "name", "nickname", "username", "phone", "memberCode", "userCode", "account_id", "storeCode",])
        ),
        Step(
            RunRequest("查看全部待评价订单")
            .get("/mall/order/getOrderPage")
            .with_params(
                **{
                    "currentPage": "1",
                    "pageSize": "10",
                    "qp-tradeStatus-in": "51",
                    "qp-memberCardCode-eq": "$memberCode",
                    "qp-storeCode-eq": "$storeCode",
                }
            )
            .with_headers(
                **{
                    "x-tenant-id": "2",
                    "sso_sessionid": "$sessionId",
                }
            )
            .with_cookies(
                **{
                    "sessionId": "$sessionId",
                    "token": "$token",
                }
            )
            .extract()
            .with_jmespath('body.data.totalCount', "totalCount")
            .with_jmespath('body.data.totalPage', "totalPage")
            .with_jmespath('body.data.pageSize', "pageSize")
            .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")
        ),

    ]