Example #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'])
Example #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)
    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 #4
0
    def test_http_rpc_accept_can_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:
        """
        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)

        # 申请帮助方:申请接受帮助, 不允许
        aft_apply_mafuluo = get_mafuluo(new_id, new_token)
        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

        # 申请帮助
        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)
        print "apply_help_result,", apply_help_result
Example #5
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 #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'])
Example #7
0
    def test_http_rpc_system_apply_help_reapply(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)

        # 申请帮助方:申请帮助
        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)
        print "apply_help_result,", apply_help_result
Example #8
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'])
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)