Example #1
0
 def test_coin_market(self, with_login):
     manager = PlatformManager('tenant')
     m_api = MarketManagementApi()
     e_api = ExchangeManagementApi()
     api = manager.account_api
     verify_api = manager.verify_api
     account_api = AccountApi()
     user = register_with_login(
         'tenant', with_login, [api, verify_api, m_api, e_api, account_api])
     self.data['user'] = user
     token = user['token']
     email = user.get('email')
     # 绑定电话
     faker = Faker('zh_CN')
     phone = faker.phone_number()
     verify = verify_info(manager, email, "bind_phone")
     manager.bind_phone(phone,
                        DEFAULT_VERIFY_CODE,
                        area_code="+86",
                        token=verify.token)
     id_number = get_random_id_number()
     individual_verify('tenant', id_number, token)
     exchange_api = ExchangeManagementApi()
     e = Exchange(exchange_api, token)
     exchange = e.get_exchange()
     e_api.exchange_post(exchange)
     # 获取交易对市场列表
     try:
         m_api.markets_get()
     except ApiException as e:
         # 交易所不存在
         assert e.status == 400
     else:
         assert False, '市场应当不存在'
     # 初审复审
     rv = account_api.accounts_account_info_get()
     account_id = rv.account_info.account_id
     self.data['account_id'] = account_id
     audit_api = AuditApi()
     admin_token = get_admin_token()
     set_login_status(audit_api, admin_token)
     rv = audit_api.tenant_audits_get(uid=account_id,
                                      exchange_name=exchange.name,
                                      type='audit')
     task = rv.items[0]
     task_id = task.id
     res = PostTenantAuditRequest(id=task_id,
                                  is_data_received=True,
                                  status='approved')
     audit_api.tenant_audits_audit_post(res)
     # 复审
     res = PostTenantReAuditRequest(id=task_id, status='approved')
     audit_api.tenant_audits_re_audit_post(res)
     rv = e_api.exchange_exchange_id_get()
     exchange_id = rv.id
     self.data['exchange_id'] = exchange_id
Example #2
0
 def test_open_market(self, with_login):
     """8.新增市场——获取交易对市场列表——开启市场——获取交易对市场"""
     m_api = MarketManagementApi()
     user = self.data['user']
     email, password = user['email'], user['password']
     token = with_login('tenant', [m_api], email, password)
     rv = m_api.markets_get()
     market_id = rv.items[0].id
     m_api.markets_id_open_put(id=market_id)
     res = m_api.markets_get()
     item = res.items[0]
     assert item.status == 'running'
Example #3
0
 def test_recharge_market(self, with_login):
     """9.新增市场——获取交易对市场列表——交易市场续费——获取交易对市场"""
     v_api = VerificationApi()
     m_api = MarketManagementApi()
     e_api = ExchangeManagementApi()
     user = self.data['user']
     email, password = user['email'], user['password']
     with_login('tenant', [m_api, e_api, e_api, v_api], email, password)
     rv = m_api.markets_get()
     market_id = rv.items[0].id
     # m_api.markets_id_open_put(id=market_id)
     rv = m_api.markets_get()
     items = rv.items
     assert len(items) == 1
     item = items[0]
     disabled_at = item.disabled_at
     data = PostOrderMarketRenewRequest(market_id=market_id,
                                        allotted_time=AllottedTime._6month)
     res = e_api.exchange_order_market_renew_post(data)
     order_id = res.order_id
     data = {
         "challenge": "048ebbe51f829995db76ac4b81546403",
         "seccode": "048ebbe51f829995db76ac4b81546403",
         "validate": "true",
         "account": "mailto:[email protected]",
         "code": "666666",
         "secondCode": "Ls1w1w",
         "type": "pay"
     }
     rv = v_api.accounts_verify_post(data)
     # 支付订单
     res = PutOrderMarketRequest(order_id=order_id, token=rv.token)
     e_api.exchange_order_market_renew_put(res)
     # 获取市场列表
     rv = m_api.markets_get()
     items = rv.items
     assert len(items) == 1
     item = items[0]
     disabled_at_1 = item.disabled_at
     allot = relativedelta(disabled_at_1, disabled_at).months
     assert allot == AllottedTime._6month
Example #4
0
 def test_update_market(self, with_login):
     """6.新增市场——获取交易对市场列表——修改市场信息——获取交易对市场"""
     # 获取交易对市场
     m_api = MarketManagementApi()
     user = self.data['user']
     email, password = user['email'], user['password']
     token = with_login('tenant', [m_api], email, password)
     rv = m_api.markets_get()
     market_id = rv.items[0].id
     market_detail = m_api.markets_id_get(market_id)
     new_fee_rate = str(market_detail.fee_rate + 0.001)  # 后续去掉str
     m_api.markets_id_put(id=market_id, fee_rate=new_fee_rate)
     market_detail_1 = m_api.markets_id_get(market_id)
     assert market_detail_1.fee_rate == float(new_fee_rate)  # 后续去掉float
Example #5
0
 def test_open_market(self, with_login):
     """8.新增市场——获取交易对市场列表——开启市场——获取交易对市场"""
     m_api = MarketManagementApi()
     user = self.data['user1']
     email, password = user['email'], user['password']
     token = with_login('tenant', [m_api], email, password)
     rv = m_api.markets_get()
     market_id = rv.items[0].id
     try:
         m_api.markets_id_open_put(id=market_id)
     except Exception as e:
         assert e.status == 400
     else:
         assert False, '市场running状态,不应该申请open'
Example #6
0
 def test_market_detail(self, with_login):
     """5.新增市场——获取交易对市场列表——获取交易币种——获取交易对市场单价——获取市场详情"""
     # 获取交易对市场
     m_api = MarketManagementApi()
     user = self.data['user']
     email, password = user['email'], user['password']
     with_login('tenant', [m_api], email, password)
     rv = m_api.markets_get()
     market_id = rv.items[0].id
     market_detail = m_api.markets_id_get(market_id)
     assert market_detail.id == market_id
     # total_rate = float(TestMarket1.fee_rate) + float(self.service_rate)
     # assert market_detail.total_rate == 0.00011  # todo 暂时不测这个
     # assert market_detail.fee_rate == Decimal(TestMarket1.fee_rate)  # todo 暂时不测这个
     # assert market_detail.service_rate == float(TestMarket1.service_rate)
     assert market_detail.buyer_coin_id == str(
         self.data['b_coin'].id)  # todo 后续去掉str
     assert market_detail.seller_coin_id == str(
         self.data['s_coin'].id)  # todo 后续去掉str
Example #7
0
 def test_close_market(self, with_login):
     """7.新增市场——获取交易对市场列表——关闭市场——获取交易对市场"""
     a_api = AccountApi()
     audit_api = AuditApi()
     v_api = VerificationApi()
     m_api = MarketManagementApi()
     e_api = ExchangeManagementApi()
     user = self.data['user']
     email, password = user['email'], user['password']
     token = with_login('tenant', [a_api, m_api, v_api, e_api], email,
                        password)
     rv = m_api.markets_get()
     market_id = rv.items[0].id
     res = PostMarketCloseRequest(id=market_id, closing_reason='a' * 11)
     data = {
         "challenge": "048ebbe51f829995db76ac4b81546403",
         "seccode": "048ebbe51f829995db76ac4b81546403",
         "validate": "true",
         "account": "mailto:[email protected]",
         "code": "666666",
         "secondCode": "Ls1w1w",
         "type": "close_market"
     }
     rv = v_api.accounts_verify_post(data)
     res.token = rv.token
     rv = m_api.markets_close_post(res)
     res = m_api.markets_get()
     item = res.items[0]
     assert item.status == 'in_review'
     # 合并测试用例
     """11.前台申请关闭交易市场——关闭交易所市场审核列表——关闭交易所市场审核详情初审
     ——提交关闭交易所审核初审——关闭交易所市场审核列表"""
     # 审核列表
     rv = e_api.exchange_exchange_id_get()
     exchange_id = rv.id
     admin_token = get_admin_token()
     set_login_status(audit_api, admin_token)
     rv = audit_api.shutdown_market_audits_get(page=1,
                                               exchange_id=exchange_id)
     item = rv.items[0]
     status = item.status
     assert status == 'audit'
     ticket_number = item.ticket_number
     rv = audit_api.shutdown_market_audits_id_tasks_audit_get(ticket_number)
     account_info = a_api.accounts_account_info_get()
     account_id = account_info.account_info.account_id
     assert rv.uid == account_id
     assert rv.exchange_id == exchange_id
     s = self.data['s_coin'].name
     b = self.data['b_coin'].name
     assert rv.trading_pair == f'{s}/{b}'
     # 初审
     data = PostShutdownMarketAuditRequest(id=ticket_number,
                                           status='approved')
     audit_api.shutdown_market_audits_audit_post(data)
     res = m_api.markets_get()
     item = res.items[0]
     assert item.status == 'in_review'
     # 获取初审详情
     rv = audit_api.shutdown_market_audits_id_audit_get(ticket_number)
     assert rv.audit_status == 'approved'
     rv = audit_api.shutdown_market_audits_get(exchange_id=exchange_id)
     item = rv.items[0]
     assert item.status == 're_audit'
     # 合并测试用例
     """12.申请关闭交易所市场初审通过——关闭交易所市场审核列表
     ——提交关闭交易所审核复审——关闭交易所市场审核列表"""
     rv = audit_api.shutdown_market_audits_id_tasks_re_audit_get(
         id=ticket_number)
     assert rv.audit_status == 'approved'
     # 复审
     data = PostShutdownMarketReAuditRequest(id=ticket_number,
                                             status='approved')
     audit_api.shutdown_market_audits_re_audit_post(data)
     # 复审详情
     rv = audit_api.shutdown_market_audits_id_re_audit_get(ticket_number)
     assert rv.audit_status == 'approved'
     assert rv.re_status == 'approved'
     rv = audit_api.shutdown_market_audits_get(exchange_id=exchange_id)
     item = rv.items[0]
     assert item.status == 'approved'
     res = m_api.markets_get()
     item = res.items[0]
     assert item.status == 'wait_close'
Example #8
0
    def test_market_exchange(self, with_login):
        """添加测试用例,两个交易所对接同一个市场,手动在数据库中修改两者为深度共享"""
        manager = PlatformManager('tenant')
        m_api = MarketManagementApi()
        e_api = ExchangeManagementApi()
        api = manager.account_api
        verify_api = manager.verify_api
        account_api = AccountApi()
        v_api = VerificationApi()
        pm = ProjectManagementApi()
        vc = VentureContactsApi()
        user = register_with_login(
            'tenant', with_login,
            [vc, pm, api, v_api, verify_api, m_api, e_api, account_api])
        self.data['user1'] = user
        token0 = user['token']
        email = user.get('email')
        # 绑定电话
        faker = Faker('zh_CN')
        phone = faker.phone_number()
        verify = verify_info(manager, email, "bind_phone")
        manager.bind_phone(phone,
                           DEFAULT_VERIFY_CODE,
                           area_code="+86",
                           token=verify.token)
        id_number = get_random_id_number()
        individual_verify('tenant', id_number, token0)
        exchange_api = ExchangeManagementApi()
        e = Exchange(exchange_api, token0)
        exchange = e.get_exchange()
        e_api.exchange_post(exchange)
        rv = account_api.accounts_account_info_get()
        account_id = rv.account_info.account_id
        audit_api = AuditApi()
        admin_token = get_admin_token()
        set_login_status(audit_api, admin_token)
        rv = audit_api.tenant_audits_get(uid=account_id,
                                         exchange_name=exchange.name,
                                         type='audit')
        task = rv.items[0]
        task_id = task.id
        res = PostTenantAuditRequest(id=task_id,
                                     is_data_received=True,
                                     status='approved',
                                     failure_type=1)
        audit_api.tenant_audits_audit_post(res)
        # 复审
        res = PostTenantReAuditRequest(id=task_id,
                                       status='approved',
                                       failure_type=None)
        audit_api.tenant_audits_re_audit_post(res)
        rv = e_api.exchange_exchange_id_get()
        exchange_id = rv.id
        # 对接币种
        contacts_api = ContactsApi()
        user = self.data['user']
        email, password = user['email'], user['password']
        token = with_login('tenant', [contacts_api], email, password)
        project_id = self.data['project_id']
        req = {
            'exchangeId': exchange_id,
            'projectId': project_id,
            'sponsor': 'tenant'
        }

        rv = contacts_api.contacts_post(req)
        # 处理对接邀请
        rv = pm.projects_id_contacts_get(project_id, 'tenant')
        # 处理对接邀请
        contact_id = rv.items[0].contact_id
        vc.contacts_put({'contactId': contact_id, 'status': 'accepted'})
        #
        # rv = contacts_api.contacts_projects_exchange_id_get(exchange_id,
        #                                                     'pending')
        # contact_id = rv.items[0].id
        # contacts_api.contacts_put({'contactId': contact_id,
        #                            'status': 'accepted'})
        rv = contacts_api.contacts_check_get(project_id=project_id,
                                             exchange_id=exchange_id)
        assert rv.result
        rv = e_api.exchange_exchange_coin_get()
        res = PostOrderMarketRequest()
        s_coin = self.data['s_coin']
        b_coin = self.data['b_coin']
        res.seller_coin_id = s_coin.id
        res.buyer_coin_id = b_coin.id
        res.allotted_time = AllottedTime._6month
        res.fee_rate = TestMarket1.fee_rate
        rv = e_api.exchange_exchange_coin_get()
        # 配置交易对市场
        rv = e_api.exchange_order_market_post(res)
        order_id = rv.order_id
        usdt_id = b_coin.id
        # 充钱
        free_charge(token0, usdt_id, account_id)

        data = {
            "challenge": "048ebbe51f829995db76ac4b81546403",
            "seccode": "048ebbe51f829995db76ac4b81546403",
            "validate": "true",
            "account": "mailto:[email protected]",
            "code": "666666",
            "secondCode": "Ls1w1w",
            "type": "pay"
        }
        rv = v_api.accounts_verify_post(data)
        p = PutOrderMarketRequest(order_id=order_id, token=rv.token)
        e_api.exchange_order_market_put(p)
        # 获取交易对市场
        rv = m_api.markets_get()
        items = rv.items
        assert len(items) == 1
Example #9
0
    def test_add_market(self, with_login):
        user = self.data['user']
        email, password = user['email'], user['password']
        m_api = MarketManagementApi()
        e_api = ExchangeManagementApi()
        s_api = SponsorApi()
        venture_api = VentureApi()
        va_api = VentureAccountApi()
        project_api = ProjectApi()
        contacts_api = ContactsApi()
        tam_api = TenantAssetManagementApi()
        v_api = VerificationApi()
        ma_api = MainExchangeApi()
        vc = VentureContactsApi()
        pm = ProjectManagementApi()
        token = with_login('tenant', [
            pm, vc, ma_api, v_api, contacts_api, project_api, m_api, e_api,
            va_api, s_api, venture_api, tam_api
        ], email, password)
        # 授权
        res = PostPlatFormRegisterRequest()
        va_api.create_platform(body=res)
        # 交易币种
        rv = e_api.exchange_exchange_coin_get()
        seller_coin = rv.seller_coin
        buyer_coin = rv.buyer_coin
        b_coin = buyer_coin[0]
        if seller_coin:
            s_coin = seller_coin[0]
        else:
            sponsor = get_sponsors()
            # 登录保健方
            account, password = sponsor['account'], sponsor['password']
            sponsor_api = SponsorApi()
            sponsor_token = get_sponsor_token(account, password, email='test')
            set_login_status(sponsor_api, sponsor_token)
            project = get_project(token)
            # req = ApplicationRequest(**project)
            rv = venture_api.applications_post(body=project)
            application_id = rv.id
            # 查看申请详情
            rv = venture_api.applications_id_get(application_id)
            assert rv.status == 'undone'
            # 查看申请裂表
            rv = venture_api.applications_get(page=1)
            assert len(rv.items) == 1
            item = rv.items[0]
            assert item.project_name == project['projectName']
            assert item.fullname == project['fullName']
            assert item.short_name == project['shortName']
            rv = venture_api.applications_num_get(status='under_review')
            assert int(rv.result) == 0
            rv = venture_api.applications_num_get(status='passed')
            assert int(rv.result) == 0
            rv = venture_api.applications_num_get(status='undone')
            assert int(rv.result) == 1
            # 设置保健机构
            venture_api.applications_id_set_sponsor_put(
                application_id, {'sponsorId': sponsor['id']})
            rv = venture_api.applications_num_get(status='undone')
            assert int(rv.result) == 0
            rv = venture_api.applications_num_get(status='under_review')
            assert int(rv.result) == 1
            rv = venture_api.applications_num_get(status='passed')
            assert int(rv.result) == 0
            rv = venture_api.applications_id_get(application_id)
            assert rv.status == 'under_review'
            project_name = project['projectName']
            sponsor_project_api = SponsorsProjectApi()
            set_login_status(sponsor_project_api, sponsor_token)
            rv = sponsor_project_api.projects_get(page=1,
                                                  project_name=project_name)
            assert len(rv.items) >= 1
            rv = sponsor_project_api.projects_id_get(id=application_id)
            assert rv
            # 保健通过
            sponsor_project_api.projects_sponsor_put({
                'id': application_id,
                'status': 1,
                'remark': 'test'
            })
            rv = venture_api.applications_num_get(status='undone')
            assert int(rv.result) == 0
            rv = venture_api.applications_num_get(status='under_review')
            assert int(rv.result) == 0
            rv = venture_api.applications_num_get(status='passed')
            assert int(rv.result) == 1
            rv = venture_api.applications_id_get(application_id)
            assert rv.status == 'passed'
            # 保鉴成功列表
            rv = sponsor_project_api.sponsor_record_success_get(
                page=1, coin_name=project['shortName'])
            assert len(rv.items) == 1
            assert rv.items[0].full_name == project['fullName']
            # 项目列表
            rv = venture_api.projects_get(page=1)
            project_id = rv.items[0].project_id
            self.data['project_id'] = project_id
            # 设置接入方式
            setting = PutProjectRequestSetting(access_method='verification',
                                               open=True)
            req = PutProjectRequest()
            req.setting = setting
            venture_api.projects_id_put(project_id, 'setting', req)
            # 获取项目详情
            rv = venture_api.projects_id_get(project_id)
            exchange_id = TestMarket1.data['exchange_id']
            # 初始化项目
            s_api = SystemManagementApi()
            staff_project_api = StaffProjectApi()
            asset_management_api = AssetManagementApi()
            admin_token = get_admin_token()
            set_login_status(staff_project_api, admin_token)
            set_login_status(asset_management_api, admin_token)
            set_login_status(s_api, admin_token)
            coin_name = project['shortName']
            rv = asset_management_api.asset_mgmt_coins_get(coin_name=coin_name)
            coin_id = rv.items[0].coin_id
            coin_config_id = rv.items[0].id
            # 修改币种配置
            res = PutSystemCoinsInitRequest()
            res.usdt_price = '1251'
            res.rc_times = 8
            res.wc_times = 8
            res.withdraw_rate = 0.1
            res.min_withdraw = 100
            res.min_withdraw_fee = 0.1
            res.max_withdraw = 1000
            res.min_recharge = 10
            res.address_tag_switch = True
            res.day_withdraw_total = 125564
            res.address_type = 'OX'
            res.address_url = 'http://unknown.com'
            res.txid_url = 'http://unknown.com'
            # asset_management_api.asset_mgmt_coins_id_put(coin_id, res)
            asset_management_api.asset_mgmt_coins_id_init_put(
                coin_config_id, res)
            rv = s_api.system_trading_pair_get(name=project['shortName'],
                                               partition_id=b_coin.id)
            # 对接币种
            req = {
                'exchangeId': exchange_id,
                'projectId': project_id,
                'sponsor': 'tenant'
            }
            contacts_api.contacts_post(req)
            rv = contacts_api.contacts_check_get(project_id, exchange_id)
            rv = pm.projects_id_contacts_get(project_id, 'tenant')
            # 处理对接邀请
            contact_id = rv.items[0].contact_id
            vc.contacts_put({'contactId': contact_id, 'status': 'accepted'})
            rv = contacts_api.contacts_check_get(project_id=project_id,
                                                 exchange_id=exchange_id)
            assert rv.result
            rv = e_api.exchange_exchange_coin_get()
            seller_coin = rv.seller_coin
            s_coin = seller_coin[0]
            # 主平台获取买卖方币种列表
            rv = ma_api.exchanges_exchange_coin_exchange_id_get(exchange_id)
            assert rv.seller_coin[0].name == project['shortName']
        self.data['s_coin'] = s_coin
        self.data['b_coin'] = b_coin
        res = PostOrderMarketRequest()
        res.seller_coin_id = s_coin.id
        res.buyer_coin_id = b_coin.id
        res.allotted_time = AllottedTime._6month
        res.fee_rate = TestMarket1.fee_rate
        now = datetime.now()
        create_at = now.strftime("%Y-%m")
        disabled_at = now + relativedelta(months=AllottedTime._6month)
        disabled_at = disabled_at.strftime("%Y-%m")
        rv = e_api.exchange_exchange_coin_get()
        # 配置交易对市场
        rv = e_api.exchange_order_market_post(res)
        order_id = rv.order_id
        usdt_id = b_coin.id
        # 充钱
        free_charge(token, usdt_id, self.data['account_id'])

        rv = tam_api.asset_mgmt_assets_get()
        # 临时接口充币
        rv = tam_api.asset_mgmt_balance_coin_id_get(usdt_id)
        data = {
            "challenge": "048ebbe51f829995db76ac4b81546403",
            "seccode": "048ebbe51f829995db76ac4b81546403",
            "validate": "true",
            "account": "mailto:[email protected]",
            "code": "666666",
            "secondCode": "Ls1w1w",
            "type": "pay"
        }
        rv = v_api.accounts_verify_post(data)
        p = PutOrderMarketRequest(order_id=order_id, token=rv.token)
        e_api.exchange_order_market_put(p)
        # 获取交易对市场
        rv = m_api.markets_get()
        items = rv.items
        assert len(items) == 1
        item = items[0]
        sell_coin_name = s_coin.name
        buy_coin_name = b_coin.name
        # total_rate = TestMarket1.fee_rate + float(TestMarket1.service_rate)
        # assert item.total_rate == 0.00011  # todo暂时不测这个
        # assert item.fee_rate == TestMarket1.fee_rate  # todo暂时不测这个
        assert item.status == 'running'
        assert item.trading_pair == f'{sell_coin_name}/{buy_coin_name}'
        assert item.created_at.strftime('%Y-%m') == create_at
        assert item.disabled_at.strftime('%Y-%m') == disabled_at

        # 获取交易所总数据
        rv = ma_api.exchanges_total_data_get()
        assert float(rv.exchange_amount) >= 1

        # 批量修改交易币对单价
        s_api.system_trading_pair_update_list_put(1111, True, True)
        rv = s_api.system_trading_pair_get(partition_id=b_coin.id)
        for each in rv.items:
            assert float(each.price) == 1111
Example #10
0
 def test_coin_market(self, with_login):
     manager = PlatformManager('tenant')
     m_api = MarketManagementApi()
     e_api = ExchangeManagementApi()
     api = manager.account_api
     verify_api = manager.verify_api
     account_api = AccountApi()
     contacts_api = ContactsApi()
     vc = VentureContactsApi()
     venture_pm = ProjectManagementApi()
     tenant_ca = TenantContactsApi()
     user = register_with_login('tenant', with_login, [
         api, verify_api, m_api, e_api, account_api, contacts_api, vc,
         venture_pm, tenant_ca
     ])
     self.data['user2'] = user
     token = user['token']
     email = user.get('email')
     # 绑定电话
     faker = Faker('zh_CN')
     phone = faker.phone_number()
     verify = verify_info(manager, email, "bind_phone")
     manager.bind_phone(phone,
                        DEFAULT_VERIFY_CODE,
                        area_code="+86",
                        token=verify.token)
     id_number = get_random_id_number()
     individual_verify('tenant', id_number, token)
     exchange_api = ExchangeManagementApi()
     e = Exchange(exchange_api, token)
     exchange = e.get_exchange()
     e_api.exchange_post(exchange)
     # 获取交易对市场列表
     try:
         m_api.markets_get()
     except ApiException as e:
         # 交易所不存在
         assert e.status == 400
     else:
         assert False, '市场应当不存在'
     # 初审复审
     rv = account_api.accounts_account_info_get()
     account_id = rv.account_info.account_id
     self.data['account_id'] = account_id
     audit_api = AuditApi()
     admin_token = get_admin_token()
     set_login_status(audit_api, admin_token)
     rv = audit_api.tenant_audits_get(uid=account_id,
                                      exchange_name=exchange.name,
                                      type='audit')
     task = rv.items[0]
     task_id = task.id
     res = PostTenantAuditRequest(id=task_id,
                                  is_data_received=True,
                                  status='approved')
     audit_api.tenant_audits_audit_post(res)
     # 复审
     res = PostTenantReAuditRequest(id=task_id, status='approved')
     audit_api.tenant_audits_re_audit_post(res)
     rv = e_api.exchange_exchange_id_get()
     exchange_id = rv.id
     self.data['exchange_id'] = exchange_id
     rv = e_api.exchange_exchange_coin_get()
     seller_coin = rv.seller_coin
     buyer_coin = rv.buyer_coin
     b_coin = buyer_coin[0]
     if seller_coin:
         s_coin = seller_coin[0]
     else:
         # 对接币种
         # 租户主动发起对接
         project_id1 = self.data['project_id1']
         project_id2 = self.data['project_id2']
         req = {
             'exchangeId': exchange_id,
             'projectId': project_id1,
             'sponsor': 'tenant'
         }
         contacts_api.contacts_post(req)
         # 项目方主动发起对接
         req = {
             'exchangeId': exchange_id,
             'projectId': project_id2,
             'sponsor': 'venture'
         }
         vc.contacts_post(req)
         rv1 = venture_pm.projects_id_contacts_get(project_id1, 'tenant')
         rv2 = tenant_ca.contacts_projects_exchange_id_get(
             exchange_id, 'pending')
         # 处理对接邀请
         contact_id1 = rv1.items[0].contact_id
         contact_id2 = rv2.items[0].id
         vc.contacts_put({'contactId': contact_id1, 'status': 'accepted'})
         rv = contacts_api.contacts_check_get(project_id=project_id1,
                                              exchange_id=exchange_id)
         # pprint(rv)
         contacts_api.contacts_put({
             'contactId': contact_id2,
             'status': 'accepted'
         })
         rv = vc.contacts_check_get(project_id2, exchange_id)
         rv = contacts_api.contacts_check_get(project_id1, exchange_id)
         assert rv.result
         rv = contacts_api.contacts_project_id_status_get(project_id1)
         assert rv.status == 'accepted'
         rv = contacts_api.contacts_project_id_status_get(project_id2)
         assert rv.status == 'accepted'