Beispiel #1
0
def test_query_coupon_detail():
    '''
    正常查询优惠券详情
    :return:
    '''
    params = test_data[ "case1" ][ "params" ]
    result = api_client.http_post( url, params, api_client.MANAGER_TOKEN, api_client.LOGIN_TYPE_MANAGER )

    assert result[ "result" ][ "couponEntity" ][ "couponId" ] == test_data[ "case1" ][ "params" ][ "couponId" ]
Beispiel #2
0
def test_add_diff_business_coupon():
    '''
    创建不同的业务券成功
    :return:
    '''
    params = test_data["case2"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    assert result["result"] == True
Beispiel #3
0
def test_CouponEntity_couponId_cannot_be_string():
    '''
    CouponEntity的couponId不能是字符串
    :return:
    '''
    params = test_data["case13"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    assert result["result"]["queryData"]["totalCount"] == 0
Beispiel #4
0
def test_add_merchant_coupon():
    '''
    创建商家券成功-基本流程
    :return:
    '''
    params = test_data["case2"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    assert result["result"] == True
Beispiel #5
0
def test_CouponEntity_not_exist():
    '''
    CouponEntity对应的查询参数,若不存在,则返回为空
    :return:
    '''
    params = test_data["case10"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    assert result["result"]["queryData"]["totalCount"] == 0
    assert len(result["result"]["queryData"]["dataList"]) == 0
Beispiel #6
0
def test_CouponEntity_couponId():
    '''
    CouponEntity的couponId起作用
    :return:
    '''
    params = test_data["case8"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    assert result[ "result" ][ "queryData" ][ "dataList" ][ 0 ][ "couponId" ] == \
           test_data[ "case8" ][ "params" ][ "param" ][ "couponId" ]
Beispiel #7
0
def test_CouponEntity_couponName_not_exsit():
    '''
    CouponEntity的couponName不存在或错误
    :return:
    '''
    params = test_data["case7"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    assert result["result"]["queryData"]["totalCount"] == 0
    assert len(result["result"]["queryData"]["dataList"]) == 0
Beispiel #8
0
def test_CouponEntity_status():
    '''
    CouponEntity的status起作用
    :return:
    '''
    params = test_data["case5"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    mysql_util.query(test_data["case5"]["verify_sql"])
    total_count = mysql_util.fetchOneRow()[0]
    assert total_count == result["result"]["queryData"]["totalCount"]
Beispiel #9
0
def test_pageSize_and_currentPage():
    '''
    pageSize&currentPage分页参数起作用
    :return:
    '''
    params = test_data["case3"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    assert result["result"]["queryData"]["pageSize"] == test_data["case3"][
        "params"]["pageSize"]
    assert result["result"]["queryData"]["currPage"] == test_data["case3"][
        "params"]["currentPage"]
Beispiel #10
0
def test_CouponEntity_couponName():
    '''
    CouponEntity的couponName起作用
    :return:
    '''
    params = test_data["case6"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    assert result[ "result" ][ "queryData" ][ "dataList" ][ 0 ][ "couponName" ] == \
           test_data[ "case6" ][ "params" ][ "param" ][
               "couponName" ]
    mysql_util.query(test_data["case6"]["verify_sql"])
    total_count = mysql_util.fetchOneRow()[0]
    assert result["result"]["queryData"]["totalCount"] == total_count
Beispiel #11
0
def test_add_business_coupon():
    '''
    创建业务券成功-基本流程
    :return:
    '''
    params = test_data["case1"]["params"]
    mysql_util.update(test_data["case1"]["init_sql1"])
    mysql_util.query(test_data["case1"]["init_sql2"])
    if mysql_util.getRowCount():
        coupon_code_id = mysql_util.fetchOneRow()[0]
        delete_sql = test_data["case1"]["init_sql3"]
        mysql_util.update(delete_sql.format(coupon_code_id))
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    assert result["result"] == True
Beispiel #12
0
def test_query_approve_list_with_listType():
    '''
    使用listType查询审批列表
    :return:
    '''
    params = test_data["case2"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    # 数据库结果条数与查询结果条数比较
    mysql_util.query(test_data["case2"]["verify_total_count_sql"])
    total_count = mysql_util.fetchOneRow()[0]
    assert total_count == result["result"]["queryData"]["totalCount"]

    mysql_util.query(test_data["case2"]["verify_been_approval_count_sql"])
    been_approval_count = mysql_util.fetchOneRow()[0]
    assert been_approval_count == result["result"]["approvalCount"]

    mysql_util.query(test_data["case2"]["verify_not_approval_count_sql"])
    not_approval_count = mysql_util.fetchOneRow()[0]
    assert not_approval_count == result["result"]["notApprovalCount"]
Beispiel #13
0
def test_query_with_default_params():
    '''
    默认参数查询管理列表
    :return:
    '''
    params = test_data["case1"]["params"]
    result = api_client.http_post(url, params, api_client.MANAGER_TOKEN,
                                  api_client.LOGIN_TYPE_MANAGER)

    assert result["result"]["queryData"]["pageSize"] == test_data["case1"][
        "params"]["pageSize"]
    # 数据库结果条数与查询结果条数比较
    mysql_util.query(test_data["case1"]["verify_sql"])
    sql_result_count = mysql_util.fetchOneRow()[0]
    if sql_result_count > result["result"]["queryData"]["pageSize"]:
        data_list_count = result["result"]["queryData"]["pageSize"]
        assert data_list_count == result["result"]["queryData"]["pageSize"]
    else:
        data_list_count = sql_result_count
        assert data_list_count == len(
            result["result"]["queryData"]["dataList"])