Exemplo n.º 1
0
def apply_from_req_2_confirm_flow_auto(utest_obj,
                                       apply_id,
                                       apply_passwd,
                                       apply_token,
                                       pay_cfrm=True):
    """
    请求-自动匹配-支付-确认完整流程
    :param utest_obj:
    :param apply_id:
    :param apply_passwd:
    :param apply_token:
    :param pay_cfrm:是否确认支付,默认True
    :return:
    """
    apply_money = random_apply_money(apply_id)
    # 接受帮助方
    accept_id, accept_passwd = new_account()
    add_accept_help_result = add_accept_help(MMMDAHttpRpcClt, admin0d_id,
                                             admin01_passwd, accept_id,
                                             apply_money)
    print "add_accept_help_result,", add_accept_help_result

    # 申请帮助方
    add_apply_help_result = add_apply_help(MMMDAHttpRpcClt, admin0d_id,
                                           admin01_passwd, apply_id,
                                           apply_money)
    print "add_apply_help_result,", add_apply_help_result

    # 自动匹配
    auto_match_result = auto_match(MMMDAHttpRpcClt, admin0d_id, admin01_passwd,
                                   apply_id, accept_id, apply_money)
    utest_obj.assertTrue(auto_match_result == error_code.ERROR_SUCCESS)
    if pay_cfrm:
        paid_confirm(utest_obj, apply_id, apply_token)
Exemplo n.º 2
0
    def test_http_rpc_apply_help_list_normal(self):
        """
        gm申请帮助列表显示
         注意:如果要测试以下流程,mmm_da需要开启以下模式--apply_req second_1 --match second_11 --apply_pay second_21 --accept_req second_31 --day_seconds 1 --force_mtype system --enable_active False --enable_seal False  --enable_pay_check False
        :return:
        """
        apply_id, apply_passwd = new_account()
        apply_token = new_access_token(apply_id, apply_passwd)
        print "apply_id,", apply_id

        apply_money = random_apply_money(apply_id)
        # 申请帮助方:申请帮助
        add_apply_help_result = add_apply_help(MMMDAHttpRpcClt, admin0d_id,
                                               admin01_passwd, apply_id,
                                               apply_money)
        print "add_apply_help_result,", add_apply_help_result

        # admin 可以访问
        apply_help_list_result = apply_help_list(MMMDAHttpRpcClt, admin0d_id,
                                                 admin01_access_token)
        print "apply_help_list_result,", apply_help_list_result
        self.assertTrue(
            apply_help_list_result['result'] == error_code.ERROR_SUCCESS)
        self.assertTrue(apply_help_list_result['apply_help_list'])
        apply_help_id_ls = map(lambda dic: dic['apply_uid'],
                               apply_help_list_result['apply_help_list'])
        print "apply_help_id_ls,", apply_help_id_ls
        self.assertTrue(str(apply_id) in apply_help_id_ls)

        # 普通用户不可以访问
        self.assertRaises(Exception, apply_help_list, MMMDAHttpRpcClt,
                          apply_id, apply_token)
Exemplo n.º 3
0
    def test_http_rpc_auto_match_normal(self):
        """
        自动匹配
         注意:如果要测试以下流程,mmm_da需要开启以下模式--apply_req second_1 --match second_11 --apply_pay second_21 --accept_req second_31 --day_seconds 1 --force_mtype system --enable_active False --enable_seal False  --enable_pay_check False
        :return:
        """
        new_id, new_passwd = new_account()
        apply_money = random_apply_money(new_id)
        add_accept_help_result = add_accept_help(MMMDAHttpRpcClt, admin0d_id,
                                                 admin01_passwd, new_id,
                                                 apply_money)
        print "add_accept_help_result,", add_accept_help_result

        # 新申请帮助方:信息
        new_apply_id2, new_apply_passwd2 = new_account()
        new_apply_token2 = new_access_token(new_apply_id2, new_apply_passwd2)
        add_apply_help_result = add_apply_help(MMMDAHttpRpcClt, admin0d_id,
                                               admin01_passwd, new_apply_id2,
                                               apply_money)
        print "add_apply_help_result,", add_apply_help_result

        # 新申请帮助方:自动匹配
        auto_match_result = auto_match(MMMDAHttpRpcClt, admin0d_id,
                                       admin01_passwd, new_apply_id2, new_id,
                                       apply_money)
        self.assertTrue(auto_match_result == error_code.ERROR_SUCCESS)

        # 新申请帮助方:当前申请帮助列表
        cur_apply_help_result = cur_apply_help(MMMDAHttpRpcClt, new_apply_id2,
                                               new_apply_token2)
        print "cur_apply_help_result,", cur_apply_help_result
        self.assertTrue(cur_apply_help_result['apply_help'])
    def test_http_rpc_accept_finish_not_apply_sealed_normal(self):
        """
        接受帮助以后没有申请帮助被封号
         注意:如果要测试以下流程,mmm_da需要开启以下模式--apply_req second_1 --match second_11 --apply_pay second_21 --accept_req second_31 --day_seconds 1 --force_mtype system --enable_active False --enable_seal False  --enable_pay_check False
        :return:
        """
        # 申请帮助方
        apply_id, apply_passwd = new_account()
        apply_token = new_access_token(apply_id, apply_passwd)
        apply_money = 1000
        add_apply_help_result = add_apply_help(MMMDAHttpRpcClt, admin0d_id, admin01_passwd, apply_id, apply_money)
        print "add_apply_help_result,", add_apply_help_result

        # 接受帮助方
        accept_id, accept_passwd = new_account()
        accept_token = new_access_token(accept_id, accept_passwd)
        add_accept_help_result = add_accept_help(MMMDAHttpRpcClt, admin0d_id, admin01_passwd, accept_id, apply_money)
        print "add_accept_help_result,", add_accept_help_result

        # 接受帮助全部匹配完成
        auto_match_result = auto_match(MMMDAHttpRpcClt, admin0d_id, admin01_passwd, apply_id, accept_id, apply_money)
        self.assertTrue(auto_match_result == error_code.ERROR_SUCCESS)
        paid_confirm(self, apply_id, apply_token)

        time.sleep(SYNC_WAIT_TIME)

        # login error on sealed account, 暂时测试是不开启封号的
        self.assertRaises(Exception, login, MMMDAHttpRpcClt, accept_id, accept_passwd)
    def test_http_rpc_accept_finish_apply_normal(self):
        """
        接受帮助以后及时申请帮助没有被封号
         注意:如果要测试以下流程,mmm_da需要开启以下模式--apply_req second_1 --match second_11 --apply_pay second_21 --accept_req second_31 --day_seconds 1 --force_mtype system --enable_active False --enable_seal False  --enable_pay_check False
        :return:
        """
        # 申请帮助方
        apply_id, apply_passwd = new_account()
        apply_token = new_access_token(apply_id, apply_passwd)
        apply_money = 1000
        add_apply_help_result = add_apply_help(MMMDAHttpRpcClt, admin0d_id, admin01_passwd, apply_id, apply_money)
        print "add_apply_help_result,", add_apply_help_result

        # 接受帮助方
        accept_id, accept_passwd = new_account()
        accept_token = new_access_token(accept_id, accept_passwd)
        add_accept_help_result = add_accept_help(MMMDAHttpRpcClt, admin0d_id, admin01_passwd, accept_id, apply_money)
        print "add_accept_help_result,", add_accept_help_result

        # 接受帮助全部匹配完成
        auto_match_result = auto_match(MMMDAHttpRpcClt, admin0d_id, admin01_passwd, apply_id, accept_id, apply_money)
        self.assertTrue(auto_match_result == error_code.ERROR_SUCCESS)
        paid_confirm(self, apply_id, apply_token)

        # 申请帮助方:申请帮助
        apply_money = random_apply_money(accept_id)
        apply_help_result = apply_help(MMMDAHttpRpcClt, accept_id, accept_token, apply_money)
        self.assertTrue(apply_help_result['result'] == error_code.ERROR_SUCCESS)
        print "apply_help_result,",apply_help_result

        time.sleep(SYNC_WAIT_TIME)

        # 可以正常登陆
        login_result = login(MMMDAHttpRpcClt, accept_id, accept_passwd)
        self.assertTrue(login_result['result'] == error_code.ERROR_SUCCESS)
Exemplo n.º 6
0
    def test_http_rpc_add_apply_help_normal(self):
        """
        添加申请帮助
         注意:如果要测试以下流程,mmm_da需要开启以下模式--apply_req second_1 --match second_11 --apply_pay second_21 --accept_req second_31 --day_seconds 1 --force_mtype system --enable_active False --enable_seal False  --enable_pay_check False
        :return:
        """
        new_apply_id, new_apply_passwd = new_account()
        new_token = new_access_token(new_apply_id, new_apply_passwd)
        apply_money = random_apply_money(new_apply_id)
        add_apply_help_result = add_apply_help(MMMDAHttpRpcClt, admin0d_id,
                                               admin01_passwd, new_apply_id,
                                               apply_money)
        print "add_apply_help_result,", add_apply_help_result

        cur_accept_help_result = cur_apply_help(MMMDAHttpRpcClt, new_apply_id,
                                                new_token)
        self.assertTrue(cur_accept_help_result['apply_help'])