Exemple #1
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'])
Exemple #2
0
    def test_http_rpc_system_accept_help_notreceived_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_from_req_2_confirm_flow_auto(self,
                                           new_id,
                                           new_passwd,
                                           new_token,
                                           pay_cfrm=False)

        # 申请帮助方:当前申请帮助列表
        cur_apply_help_result = cur_apply_help(MMMDAHttpRpcClt, new_id,
                                               new_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, new_id,
                                                    new_token, apply_sorder,
                                                    "pay_msg", "/file1/file2",
                                                    "file_name.png")
            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)
            apply_sorder = apply_help_pay_result['apply_help']['apply_sorder']

            ## 睡3秒,算利息
            time.sleep(3)

            accept_uid = apply_help_info['accept_uid']
            self.assertTrue(accept_uid)
            accept_token = new_access_token(accept_uid, force_passwd)

            # 接受帮助方:申请帮助确认
            acp_help_notreceived_result = accept_help_notreceived(
                MMMDAHttpRpcClt, accept_uid, accept_token, apply_sorder)
            print "acp_help_notreceived_result,", acp_help_notreceived_result

            # 接受帮助方:当前接受帮助
            cur_accept_help_result1 = cur_accept_help(MMMDAHttpRpcClt,
                                                      accept_uid, accept_token)
            for apply_help_dic in cur_accept_help_result1['apply_help_ls']:
                if apply_help_dic['apply_sorder'] == apply_sorder:
                    self.assertTrue(
                        apply_help_dic['apply_pstat'] == APYS_PAY_UNUSUAL)
Exemple #3
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)
Exemple #4
0
    def test_http_rpc_system_apply_help_delete_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)
        apply_help_result = apply_help(MMMDAHttpRpcClt, new_id, new_token,
                                       apply_money)
        self.assertTrue(
            apply_help_result['result'] == error_code.ERROR_SUCCESS)
        self.assertTrue(apply_help_result['apply_help_ls'])
        print "apply_help_result,", apply_help_result

        # 申请帮助方:当前申请帮助列表
        cur_apply_help_result0 = cur_apply_help(MMMDAHttpRpcClt, new_id,
                                                new_token)
        print "cur_apply_help_result0,", cur_apply_help_result0, type(
            cur_apply_help_result0)
        self.assertTrue(not cur_apply_help_result0['apply_help_ls'])
        self.assertTrue(
            cur_apply_help_result0['apply_help']['apply_money'] == apply_money)

        # 申请帮助方:删除申请帮助
        del_apply_help_result = del_apply_help(
            MMMDAHttpRpcClt, new_id, new_token,
            apply_help_result['apply_help_ls'][0]['apply_order'])
        print "del_apply_help_result,", del_apply_help_result

        # 申请帮助方:当前申请帮助列表
        cur_apply_help_result1 = cur_apply_help(MMMDAHttpRpcClt, new_id,
                                                new_token)
        print "cur_apply_help_result1,", cur_apply_help_result1, type(
            cur_apply_help_result1)
        self.assertTrue(not cur_apply_help_result1['apply_help'])
Exemple #5
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'])
Exemple #6
0
def paid_confirm(utest_obj, apply_id, apply_token):
    # 申请帮助方:当前申请帮助列表
    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)
    utest_obj.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,
                                                "pay_msg", "/file1/file2",
                                                "file_name.png")
        print "apply_help_pay_result,", apply_help_pay_result
        utest_obj.assertTrue(apply_help_pay_result['apply_help']
                             ['apply_sorder'] == apply_sorder)
        utest_obj.assertTrue(apply_help_pay_result['apply_help']['apply_pstat']
                             == APYS_PAY_SUCCESS)

        ## 睡3秒,算利息
        time.sleep(3)

        accept_uid = apply_help_info['accept_uid']
        utest_obj.assertTrue(accept_uid)
        accept_token = new_access_token(accept_uid, force_passwd)

        # 接受帮助方:当前接受帮助
        cur_accept_help_result1 = cur_accept_help(MMMDAHttpRpcClt, accept_uid,
                                                  accept_token)
        print "cur_accept_help_result1,", cur_accept_help_result1
        utest_obj.assertTrue('accept_help' in cur_accept_help_result1)
        utest_obj.assertTrue('apply_help_ls' in cur_accept_help_result1)
        for apply_help_dic in cur_accept_help_result1['apply_help_ls']:
            utest_obj.assertTrue('apply_piture' in apply_help_dic)
            utest_obj.assertTrue('apply_message' in apply_help_dic)

        # 接受帮助方:申请帮助确认
        acp_help_cfm_result = accept_help_confirm(MMMDAHttpRpcClt, accept_uid,
                                                  accept_token, apply_sorder)
        print "acp_help_cfm_result,", acp_help_cfm_result
Exemple #7
0
def apply_from_req_2_confirm_flow(utest_obj, apply_id, apply_passwd,
                                  apply_token):
    """
    请求-匹配-支付-确认完整流程
    :param utest_obj:
    :param apply_id:
    :param apply_passwd:
    :param apply_token:
    :return:
    """
    apply_money = random_apply_money(apply_id)
    # 申请帮助方:申请帮助
    apply_help_result = apply_help(MMMDAHttpRpcClt, apply_id, apply_token,
                                   apply_money)
    utest_obj.assertTrue(
        apply_help_result['result'] == error_code.ERROR_SUCCESS)
    utest_obj.assertTrue(apply_help_result['apply_help_ls'])
    print "apply_help_result,", apply_help_result

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

    # 申请帮助方:再次申请帮助
    utest_obj.assertRaises(Exception, apply_help, MMMDAHttpRpcClt, apply_id,
                           apply_token, apply_money)

    # 请求等待排队
    time.sleep(SYNC_WAIT_TIME)

    # 申请帮助方:再次申请帮助
    utest_obj.assertRaises(Exception, apply_help, MMMDAHttpRpcClt, apply_id,
                           apply_token, apply_money)

    paid_confirm(utest_obj, apply_id, apply_token)
Exemple #8
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)