Exemple #1
0
    def test_http_rpc_system_accept_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_from_req_2_confirm_flow_auto(self, new_id, new_passwd, new_token)

        # 申请帮助方:申请接受帮助
        cur_mafuluo = get_mafuluo(new_id, new_token)
        accept_help_rsz = accept_help(MMMDAHttpRpcClt, new_id, new_token,
                                      random.randint(1, cur_mafuluo))
        self.assertTrue(accept_help_rsz['accept_help'])
        print "accept_help_rsz,", accept_help_rsz

        # 申请帮助方:删除接受帮助
        del_accept_help_result = del_accept_help(
            MMMDAHttpRpcClt, new_id, new_token,
            accept_help_rsz['accept_help']['accept_order'])
        print "del_accept_help_result,", del_accept_help_result

        # 申请帮助方:当前接受帮助
        cur_accept_help_result1 = cur_accept_help(MMMDAHttpRpcClt, new_id,
                                                  new_token)
        print "cur_accept_help_result1,", cur_accept_help_result1
        self.assertTrue(not cur_accept_help_result1['accept_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_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)
        print "new_id,", new_id

        # 申请帮助方:申请提供帮助
        pre_apply_mafuluo = get_mafuluo(new_id, new_token)
        print "pre_apply_mafuluo,", pre_apply_mafuluo
        self.assertTrue(pre_apply_mafuluo == 0)

        apply_from_req_2_confirm_flow(self, new_id, new_passwd, new_token)

        aft_apply_mafuluo = get_mafuluo(new_id, new_token)
        print "aft_apply_mafuluo,", aft_apply_mafuluo
        self.assertTrue(aft_apply_mafuluo > pre_apply_mafuluo)

        # 申请帮助方:申请接受帮助
        accept_help_rsz = accept_help(MMMDAHttpRpcClt, new_id, new_token,
                                      random.randint(1, aft_apply_mafuluo))
        self.assertTrue(accept_help_rsz['accept_help'])
        print "accept_help_rsz,", accept_help_rsz

        # 申请帮助方:当前接受帮助
        cur_accept_help_result1 = cur_accept_help(MMMDAHttpRpcClt, new_id,
                                                  new_token)
        print "cur_accept_help_result1,", cur_accept_help_result1
        self.assertTrue('accept_help' in cur_accept_help_result1)

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

        # 申请帮助方:当前接受帮助
        cur_accept_help_result2 = cur_accept_help(MMMDAHttpRpcClt, new_id,
                                                  new_token)
        print "cur_accept_help_result2,", cur_accept_help_result2
        self.assertTrue('accept_help' in cur_accept_help_result2)
        self.assertTrue('apply_help_ls' in cur_accept_help_result2)
Exemple #4
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'])
Exemple #5
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 #6
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'])
Exemple #7
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)