Example #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)
Example #2
0
    def test_http_rpc_accept_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:
        """
        accept_id, accept_passwd = new_account()
        accept_token = new_access_token(accept_id, accept_passwd)

        accept_money = 10000
        add_accept_help_result = add_accept_help(MMMDAHttpRpcClt, admin0d_id,
                                                 admin01_passwd, accept_id,
                                                 accept_money)
        print "add_accept_help_result,", add_accept_help_result

        # admin 可以访问
        accept_help_list_result = accept_help_list(MMMDAHttpRpcClt, admin0d_id,
                                                   admin01_access_token)
        print "accept_help_list_result,", accept_help_list_result
        self.assertTrue(
            accept_help_list_result['result'] == error_code.ERROR_SUCCESS)
        self.assertTrue(accept_help_list_result['accept_help_list'])
        accept_help_id_ls = map(lambda dic: dic['accept_uid'],
                                accept_help_list_result['accept_help_list'])
        print "accept_help_id_ls,", accept_help_id_ls
        self.assertTrue(str(accept_id) in accept_help_id_ls)

        # 普通用户不可以访问
        self.assertRaises(Exception, apply_help_list, MMMDAHttpRpcClt,
                          accept_id, accept_token)
Example #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)
Example #6
0
    def test_http_rpc_system_apply_paid_notmsg_notpiture_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:
        """
        diff_from_apply_to_accept = 1000

        # 申请帮助方:信息
        apply_id, apply_passwd = new_account()
        apply_token = new_access_token(apply_id, apply_passwd)

        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

        # 接受帮助方
        accept_id, accept_passwd = new_account()
        accept_token = new_access_token(accept_id, accept_passwd)

        accept_money = apply_money + diff_from_apply_to_accept
        add_accept_help_result = add_accept_help(MMMDAHttpRpcClt, admin0d_id,
                                                 admin01_passwd, accept_id,
                                                 accept_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)
        accept_lmoney = accept_money - apply_money
        assert accept_lmoney == diff_from_apply_to_accept

        # 申请帮助方:当前申请帮助列表
        cur_apply_help_result = cur_apply_help(MMMDAHttpRpcClt, apply_id,
                                               apply_token)
        print "cur_apply_help_result,", cur_apply_help_result, type(
            cur_apply_help_result)
        self.assertTrue(cur_apply_help_result["apply_help_ls"])

        # 申请帮助方:申请帮助支付所有订单
        for apply_help_info in cur_apply_help_result['apply_help_ls']:
            apply_sorder = apply_help_info['apply_sorder']
            apply_help_pay_result = apply_help_paid(MMMDAHttpRpcClt, apply_id,
                                                    apply_token, apply_sorder,
                                                    "", "", "")
            print "apply_help_pay_result,", apply_help_pay_result
            self.assertTrue(apply_help_pay_result['apply_help']['apply_sorder']
                            == apply_sorder)
            self.assertTrue(apply_help_pay_result['apply_help']['apply_pstat']
                            == APYS_PAY_SUCCESS)
Example #7
0
    def test_http_rpc_system_add_apply_help_normal(self):
        """
        测试添加流程
         :return:
        """
        new_id, new_passwd = new_account()
        print "new_id,",new_id
        print "new_passwd,",new_passwd
        new_token = new_access_token(new_id, new_passwd)
        add_accept_help_result = add_accept_help(MMMDAHttpRpcClt, admin0d_id, admin01_passwd, new_id, 10000)
        print "add_accept_help_result,", add_accept_help_result

        # 申请帮助方:当前接受帮助
        cur_accept_help_result = cur_accept_help(MMMDAHttpRpcClt, new_id, new_token)
        print "cur_accept_help_result,", cur_accept_help_result
        self.assertTrue(cur_accept_help_result['accept_help'])
Example #8
0
    def test_http_rpc_add_accept_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_id, new_passwd = new_account()
        new_token = new_access_token(new_id, new_passwd)

        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

        cur_accept_help_result = cur_accept_help(MMMDAHttpRpcClt, new_id,
                                                 new_token)
        print cur_accept_help_result
        self.assertTrue(cur_accept_help_result['accept_help'])
Example #9
0
    def test_http_rpc_system_apply_help_rejust(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:
        """
        diff_from_apply_to_accept = random.randint(1, 3) * 1000
        print "diff_from_apply_to_accept,", diff_from_apply_to_accept
        # 申请帮助方
        apply_id, apply_passwd = new_account()
        apply_token = new_access_token(apply_id, apply_passwd)

        apply_money = random_apply_money(apply_id)
        print "apply_money,", apply_money
        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)
        accept_money = apply_money + diff_from_apply_to_accept
        print "accept_money,", accept_money
        add_accept_help_result = add_accept_help(MMMDAHttpRpcClt, admin0d_id,
                                                 admin01_passwd, accept_id,
                                                 accept_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)

        # 申请帮助方:当前申请帮助列表
        cur_apply_help_result = cur_apply_help(MMMDAHttpRpcClt, apply_id,
                                               apply_token)
        print "cur_apply_help_result,", cur_apply_help_result
        self.assertTrue(cur_apply_help_result['apply_help'])

        # 申请帮助方:当前支付订单肯定就一个,所有强制写死
        apply_help_info = cur_apply_help_result['apply_help_ls'][0]
        apply_sorder = apply_help_info['apply_sorder']
        assert str(apply_help_info['accept_uid']) == str(accept_id)

        # 接受帮助方:当前接受帮助, apply_help_ls存在, ['accept_help']['accept_lmoney'] == accept_lmoney
        cur_accept_help_result0 = cur_accept_help(MMMDAHttpRpcClt, accept_id,
                                                  accept_token)
        print "cur_accept_help_result0,", cur_accept_help_result0
        self.assertTrue(cur_accept_help_result0['accept_help']['accept_lmoney']
                        == diff_from_apply_to_accept)
        self.assertTrue(cur_accept_help_result0['apply_help_ls'])

        # 申请帮助方:拒绝支付
        apply_help_refuse_rsz = apply_help_refuse(MMMDAHttpRpcClt, apply_id,
                                                  apply_token, apply_sorder)
        print "apply_help_refuse_rsz,", apply_help_refuse_rsz

        # 接受帮助方:当前接受帮助, 订单状态变成拒绝支付, ['accept_help']['accept_lmoney']==['accept_help']['accept_money']
        cur_accept_help_result1 = cur_accept_help(MMMDAHttpRpcClt, accept_id,
                                                  accept_token)
        print "cur_accept_help_result1,", cur_accept_help_result1
        self.assertTrue(
            cur_accept_help_result1['accept_help']['accept_lmoney'] ==
            cur_accept_help_result1['accept_help']['accept_money'])
        self.assertTrue(cur_accept_help_result1['apply_help_ls'][0]
                        ['apply_pstat'] == APYS_PAY_REFUSE)