Example #1
0
def test_api_recharge_05():
    """
    充值(黄新)
    :return: 
    """
    with pytest.allure.step("充值(黄新)"):
        global cz_amount
        cz_amount = "2000.00"
        response_dicts = req.api_request("api_recharge",
                                         token=login_token,
                                         bankCardNum=bankCardNum,
                                         bankName=bankName,
                                         amount=cz_amount)
        global reqSerial, apiPackSeq, amount, validateCodeSerialNum

        reqSerial = response_dicts['data']['reqSerial']  # 充值交易流水号

        apiPackSeq = response_dicts['data']['apiPackSeq']  # 比财报文参考号

        amount = response_dicts['data']['amount']  # 金额

        validateCodeSerialNum = response_dicts['data'][
            'validateCodeSerialNum']  # 短信验证码ID

        print(reqSerial, apiPackSeq, amount, validateCodeSerialNum)

    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("api_recharge")['code'], response_dicts['code'])
    Consts.RESULT_LIST.append('True')
Example #2
0
def test_api_query_bank_center_tx_16():
    """
    提现后查询余额
    :return: 
    """
    time.sleep(2)
    with pytest.allure.step("提现后查询余额"):
        response_dicts = req.api_request("api_query_bank_center",
                                         token=login_token)
    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("api_query_bank_center")['code'],
            response_dicts['code'])

    global totalAsset_tx  # 总资产
    global balance_tx  # 可用余额
    global hold_amount_tx  # 持有求和

    totalAsset_tx = response_dicts['data']['totalAsset']
    balance_tx = response_dicts['data']['balance']
    hold_amount_tx = 0
    for i in range((response_dicts['data']['prodList']).__len__()):
        print(response_dicts['data']['prodList'][i]['prdTypeName'] + "持有金额:" +
              response_dicts['data']['prodList'][i]['holdAmount'])
        hold_amount_tx = Decimal(response_dicts['data']['prodList'][i]
                                 ['holdAmount']) + Decimal(hold_amount_tx)
    print("总资产:" + str(totalAsset_tx))
    print("可用余额:" + str(balance_tx))
    print("持有金额求和:" + str(hold_amount_tx))
    test.assert_text(Decimal(balance_tx),
                     Decimal(balance_zq) - Decimal(tx_amount), "提现后余额")
    test.assert_text(Decimal(totalAsset_tx),
                     Decimal(totalAsset_zq) - Decimal(tx_amount), "提现后总资产")
    test.assert_text(Decimal(hold_amount_zq), Decimal(hold_amount_tx), "提现后持有")
    Consts.RESULT_LIST.append('True')
Example #3
0
def test_api_query_bank_center_02():
    """
    资产首页余额查询
    :return: 
    """
    with pytest.allure.step("资产首页--(郝志阳)"):
        response_dicts = req.api_request("api_query_bank_center",
                                         token=login_token)
    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("api_query_bank_center")['code'],
            response_dicts['code'])

    global totalAsset  # 总资产
    global balance  # 可用余额
    global hold_amount  # 持有求和
    totalAsset = response_dicts['data']['totalAsset']
    balance = response_dicts['data']['balance']
    hold_amount = 0
    for i in range((response_dicts['data']['prodList']).__len__()):
        print(response_dicts['data']['prodList'][i]['prdTypeName'] + "持有金额:" +
              response_dicts['data']['prodList'][i]['holdAmount'])
        hold_amount = Decimal(
            response_dicts['data']['prodList'][i]['holdAmount']) + hold_amount
    print("总资产:" + str(totalAsset))
    print("可用余额:" + str(balance))
    print("持有金额求和:" + str(hold_amount))
    test.assert_text(hold_amount + Decimal(balance), Decimal(totalAsset),
                     "持有产品汇总")
    Consts.RESULT_LIST.append('True')
Example #4
0
def test_post_member_select_01():
    """
    查询会员列表
    :param
    :return:
    """
    add_member_data()
    with pytest.allure.step("查询会员列表"):
        response_dicts = req.start_request("post_member_select")
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('post_member_select')['success'],
            response_dicts['success'])
        test.assert_text(
            exp_results('post_member_select')['status'],
            response_dicts['data']['list'][0]['status'])
    Consts.RESULT_LIST.append('True')
Example #5
0
def test_del_manager_label_by_id_12():
    """
    删除标签信息(逻辑删除)
    :param
    :return:
    """
    with pytest.allure.step("删除标签信息(逻辑删除)"):
        response_dicts = req.del_request("del_manager_label_by_id", bq_id)
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('del_manager_label_by_id')['success'],
            response_dicts['success'])
        test.assert_text(
            exp_results('del_manager_label_by_id')['code'],
            response_dicts['code'])
        test.assert_text(
            exp_results('del_manager_label_by_id')['message'],
            response_dicts['message'])
    Consts.RESULT_LIST.append('True')
def test_get_admin_dict_info_01(get_type_name):
    """
    获取数据字典信息
    :param
    :return:
    """
    with pytest.allure.step("取用户权限列表"):
        response_dicts = req.get_request("get_dict_type", get_type_name)
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('get_dict_type')['success'], response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #7
0
def test_get_manager_label_by_id_10():
    """
    查询标签详情
    :param
    :return:
    """
    with pytest.allure.step("查询标签详情"):
        response_dicts = req.get_request("get_manager_label_by_id", bq_id)
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('get_manager_label_by_id')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #8
0
def test_get_manager_level_15():
    """
    查询等级列表接口
    :param
    :return:
    """
    with pytest.allure.step("查询等级列表接口"):
        response_dicts = req.start_request("get_manager_level")
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('get_manager_level')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #9
0
def test_get_member_by_id_02():
    """
    查询会员列表
    :param
    :return:
    """
    with pytest.allure.step("根据id查询会员"):
        response_dicts = req.get_request("get_member_by_id", "1")
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('get_member_by_id')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #10
0
def test_api_trade_check_cz_03():
    """
    交易通用校验-(黄新),10-充值
    :return: 
    """
    with pytest.allure.step("交易通用校验-(黄新),10-充值"):
        response_dicts = req.api_request("api_trade_check",
                                         token=login_token,
                                         tradeType=10)
    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("api_trade_check")['code'], response_dicts['code'])
    Consts.RESULT_LIST.append('True')
Example #11
0
def test_post_member_batch_05():
    """
    单次给会员打标签
    :param
    :return:
    """
    with pytest.allure.step("批量给会员打标签"):
        response_dicts = req.start_request("post_member_batch")
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('post_member_batch')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #12
0
def test_get_manager_level_by_id_18():
    """
    根据id查询等级详情接口
    :param
    :return:
    """
    with pytest.allure.step("根据id查询等级详情接口"):
        response_dicts = req.get_request("get_manager_level_by_id", level_id)
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('get_manager_level_by_id')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #13
0
def test_put_member_status_03():
    """
    变更会员状态
    :param
    :return:
    """
    with pytest.allure.step("变更会员状态"):
        response_dicts = req.start_request("put_member_status", id="1")
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('put_member_status')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #14
0
def test_post_manager_level_16():
    """
    创建等级信息
    :param
    :return:
    """
    with pytest.allure.step("创建等级信息"):
        response_dicts = req.start_request("post_manager_level",
                                           name="自动化11测试22")
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('post_manager_level')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #15
0
def test_query_login_status_01():
    """
    用户开户状态查询
    :param login: 预制登录信息 获取授权token:
    :return:
    """
    global login_token
    login_token = req.get_token(13911645993)
    # login_token = 'BC-a62ce02bb89946e9b6638c3a0ab74ca7'

    with pytest.allure.step("用户开户状态查询"):
        response_dicts = req.api_request("query_login_status",
                                         token=login_token)
    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("query_login_status")['code'], response_dicts['code'])
        test.assert_text(
            exp_results("query_login_status")['hasLogin'],
            response_dicts['data']['hasLogin'], "是否需要登录银行 0:不需要登录 1:已登录 2:未登陆")
        test.assert_text(
            exp_results("query_login_status")['hasOpenBank'],
            response_dicts['data']['hasOpenBank'], "是否已开户")
    Consts.RESULT_LIST.append('True')
Example #16
0
def test_post_member_batch_level_06():
    """
    批量更新会员等级
    :param
    :return:
    """
    with pytest.allure.step("批量更新会员等级"):
        response_dicts = req.start_request("post_member_batch_level",
                                           type="LEVEL")
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('post_member_batch_level')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #17
0
def test_put_manager_level_19():
    """
    更新等级信息
    :param
    :return:
    """
    with pytest.allure.step("更新等级信息"):
        response_dicts = req.start_request("put_manager_level",
                                           id=level_id,
                                           name='自动化测试')
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('put_manager_level')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #18
0
def test_interest_calculatioin_11():
    """
    赎回利息试算(黄新)
    :return: 
    """
    with pytest.allure.step("赎回利息试算(黄新)"):
        response_dicts = req.api_request("interest_calculatioin",
                                         token=login_token,
                                         amount=amount_buy,
                                         reqSerial=reqSerial_cr)
    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("interest_calculatioin")['code'],
            response_dicts['code'])
    Consts.RESULT_LIST.append('True')
Example #19
0
def test_put_manager_label_status_13():
    """
    变更标签状态
    :param
    :return:
    """
    with pytest.allure.step("变更标签状态"):
        response_dicts = req.start_request("put_manager_label_status",
                                           id=bq_id,
                                           status="DISABLE")
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('put_manager_label_status')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
Example #20
0
def test_post_member_batch_status_07():
    """
    批量更新会员状态
    :param
    :return:
    """
    with pytest.allure.step("批量更新会员状态"):
        response_dicts = req.start_request("post_member_batch_status",
                                           type="STATUS",
                                           status="ENABLE")
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('post_member_batch_status')['success'],
            response_dicts['success'])
    Consts.RESULT_LIST.append('True')
    del_membe_data()
Example #21
0
def test_api_redemption_12():
    """
    赎回(黄新)
    :return: 
    """
    with pytest.allure.step("赎回(黄新)"):
        response_dicts = req.api_request("api_redemption",
                                         token=login_token,
                                         amount=amount_buy,
                                         reqSerial=reqSerial_cr)
    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("api_redemption")['code'], response_dicts['code'])
        test.assert_text(response_dicts['data']['amount'], amount_buy,
                         "持有列表中包含该笔交易记录")
    Consts.RESULT_LIST.append('True')
Example #22
0
def test_api_query_org_bind_card_cz_04():
    """
    机构绑卡列表查询
    :return: 
    """
    global bankName
    global bankCardNum
    with pytest.allure.step("机构绑卡列表查询"):
        response_dicts = req.api_request("api_query_org_bind_card",
                                         token=login_token)
    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("api_trade_check")['code'], response_dicts['code'])
        bankName = response_dicts['data']['cardList'][0]['bankName']
        bankCardNum = response_dicts['data']['cardList'][0]['bankCardNum']
    Consts.RESULT_LIST.append('True')
Example #23
0
def test_api_recharge_confirm_06():
    """
    充值确认(黄新)
    :return: 
    """
    with pytest.allure.step("充值确认(黄新)"):
        response_dicts = req.api_request(
            "api_recharge_confirm",
            token=login_token,
            reqSerial=reqSerial,
            validateCodeSerialNum=validateCodeSerialNum)
    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("api_recharge_confirm")['code'],
            response_dicts['code'])
        test.assert_text(cz_amount, response_dicts['data']['amount'], "充值金额")
    Consts.RESULT_LIST.append('True')
Example #24
0
def test_get_manager_label_09():
    """
    查询标签列表
    :param
    :return:
    """
    with pytest.allure.step("查询标签列表"):
        response_dicts = req.start_request("get_manager_label")
    with pytest.allure.step("断言success对比"):
        global bq_id  # 标签id
        test.assert_text(
            exp_results('get_manager_label')['success'],
            response_dicts['success'])
        # for i in range(0, response_dicts['data']['list'].__len__()):
        #     if response_dicts['data']['list'][i]['name'] == 'xc01':
        #         bq_id = response_dicts['data']['list'][i]['id']
        bq_id = act_res.get_act_value(response_dicts, "xc01")
    Consts.RESULT_LIST.append('True')
Example #25
0
def test_api_cash_15():
    """
    提现(黄新)
    :return: 
    """
    with pytest.allure.step("提现(黄新)"):
        global tx_amount
        tx_amount = "2000.00"
        response_dicts = req.api_request("api_cash",
                                         token=login_token,
                                         bankCardNum=bankCardNum,
                                         bankName=bankName,
                                         amount=tx_amount)
        with pytest.allure.step("结果对比"):
            test.assert_code(
                exp_results("api_cash")['code'], response_dicts['code'])
            test.assert_text(response_dicts['data']['amount'], tx_amount,
                             "提现金额")
        Consts.RESULT_LIST.append('True')
Example #26
0
def test_api_buy_08():
    """
    购买(黄新)
    :return: 
    """
    global amount_buy  # 购买金额
    amount_buy = "1001.00"
    with pytest.allure.step("购买(黄新)"):
        response_dicts = req.api_request("api_buy",
                                         token=login_token,
                                         amount=amount_buy)
    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("api_buy")['code'], response_dicts['code'])
        test.assert_text(Decimal(amount_buy),
                         Decimal(response_dicts['data']['amount']), "存入金额")
        global reqSerial_cr  # 交易流水号
        global apiPackSeq_cr  # 请求流水号
        reqSerial_cr = response_dicts['data']['reqSerial']
        apiPackSeq_cr = response_dicts['data']['apiPackSeq']
    Consts.RESULT_LIST.append('True')
Example #27
0
def test_get_manager_level_17():
    """
    查询等级列表接口
    :param
    :return:
    """
    with pytest.allure.step("查询等级列表接口"):
        response_dicts = req.start_request("get_manager_level")
    with pytest.allure.step("断言success对比"):
        test.assert_text(
            exp_results('get_manager_level')['success'],
            response_dicts['success'])
        global level_id
        # for i in range(0, response_dicts['data']['list'].__len__()):
        #     if response_dicts['data']['list'][i]['name'] == 'xc01':
        #         bq_id = response_dicts['data']['list'][i]['id']
        level_id = act_res.get_act_value(response_dicts, "自动化11测试22")
        print("----------------------")
        print(level_id)
        print("----------------------")

    Consts.RESULT_LIST.append('True')
Example #28
0
def test_api_query_hold_info_10():
    """
    持有列表--(郝志阳)
    :return: 
    """
    with pytest.allure.step("持有列表--(郝志阳)"):
        response_dicts = req.api_request("api_query_hold_info",
                                         token=login_token)
    ret_list = {}
    # for i in range(response_dicts['data']['retList'].__len__()):
    #     ret_list[response_dicts['data']['retList'][i]
    #              ['reqSerial']] = response_dicts['data']['retList'][i][
    #                  'dynamicList']['amount']['fieldValue']
    ret_list[response_dicts['data']['retList'][0]
             ['reqSerial']] = response_dicts['data']['retList'][0][
                 'dynamicList']['amount']['fieldValue']
    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("api_query_bank_center")['code'],
            response_dicts['code'])
        test.assert_text(Decimal(ret_list[reqSerial_cr].replace(',', '')),
                         Decimal(amount_buy), "持有列表中包含该笔交易记录")

    Consts.RESULT_LIST.append('True')
Example #29
0
def test_api_query_hold_info_sh_13():
    """
    持有列表-赎回后--(郝志阳)
    :return: 
    """
    time.sleep(2)
    with pytest.allure.step("持有列表--(郝志阳)"):
        response_dicts = req.api_request("api_query_hold_info",
                                         token=login_token)
    # ret_list = []
    # for i in range(response_dicts['data']['retList'].__len__()):
    #     ret_list.append(response_dicts['data']['retList'][i]['dynamicList']
    #                     ['reqSerial']['fieldValue'])

    with pytest.allure.step("结果对比"):
        test.assert_code(
            exp_results("api_query_bank_center")['code'],
            response_dicts['code'])
        # assert reqSerial_cr not in ret_list
        test.assert_text(
            Decimal(hold_amount_cr) - Decimal(amount_buy),
            Decimal(response_dicts['data']['totalHoldAmount']), "存入后持有")

    Consts.RESULT_LIST.append('True')