def test_investors(self, with_login):
        """3.未开通交易所——获取投资人列表列表———投资人详情(exchange id is None)"""
        manager = PlatformManager('tenant')
        account_api = AccountApi()
        api = manager.account_api
        verify_api = manager.verify_api
        user = register_with_login('tenant', with_login,
                                   [api, verify_api, account_api])
        # 绑定电话
        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)

        account_info = account_api.accounts_account_info_get()
        account_id = account_info.account_info.account_id

        exchange_api = ExchangeManagementApi()
        email, password = user['email'], user['password']
        token = with_login('tenant', [exchange_api], email, password)
        id_number = get_random_id_number()
        individual_verify('tenant', id_number, token)
        e = Exchange(exchange_api, token)
        exchange = e.get_exchange()
        exchange_api.exchange_post(exchange)
        rv = exchange_api.exchange_exchange_status_get()
        assert rv.status == 'pending'
        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='disapproved',
                                       failure_type='ENTERPRISE_LICENSE')
        audit_api.tenant_audits_re_audit_post(res)

        api = AccountManagementApi()
        admin_token = get_admin_token()
        set_login_status(api, admin_token)
        a_api = AccountApi()
        token = with_login('tenant', [a_api], email, password)
        account_info = a_api.accounts_account_info_get()
        account_id = account_info.account_info.account_id
        rv = api.accounts_investors_get(account_id=account_id)
        investors = rv.items
        assert len(investors) > 0
        rv = api.accounts_accounts_id_get(id=account_id)
        assert rv.basic_info.exchange_id is None
Esempio n. 2
0
 def test_models_case1(self):
     # 后台登录
     content_api = ContentManagementApi()
     staff_token = get_admin_token()
     set_login_status(content_api, staff_token)
     # 新建文章模型
     payload = {
         'identification': get_random_name(2, 50),
         'name': get_random_name(2, 50),
         'status': True,
         'order': random.randint(100000, 999999),
         'type': 'article'  # article文章,kinmall金猫
     }
     content_api.models_post(body=payload)
     # 获取文章模型列表
     res = content_api.models_get(type='article')
     for item in res.items:
         if item.name == payload['name']:
             assert item.identification == payload['identification']
             assert item.id
     # 获取文章模型名称列表
     res = content_api.models_names_get(type='article')
     id_ = ''
     for item in res.items:
         if item.name == payload['name']:
             assert item.id
             id_ = item.id
     # 获取文章模型详情
     res = content_api.models_id_get(id=id_)
     assert res.name == payload['name']
     assert res.status == payload['status']
     assert res.order == payload['order']
     assert res.type == payload['type']
     assert res.identification == payload['identification']
Esempio n. 3
0
 def test_legals_trans_coin_fail(self, amount, coin_name, otc_user):
     """
     法币化转到币币失败
     """
     # 后台登录验证
     staff_token = get_admin_token()
     set_login_status(staff_balance_api, staff_token)
     set_login_status(staff_asset_api, staff_token)
     user_res_info = otc_user([otc_balance_api, otc_asset_api])
     coin_id = user_res_info['buyer_coin_id']
     # 获取otc法币余额,币币余额
     before_res1 = otc_balance_api.balance_info_currency_id_get(
         currency_id=coin_id)
     assert before_res1
     before_res2 = otc_asset_api.asset_mgmt_assets_coin_id_get(
         coin_id=coin_id)
     assert before_res2
     # 币币划转到法币失败
     transload = TransferToRequest(currency_id=coin_id, amount=amount)
     try:
         otc_balance_api.balance_transfer_to_post(transload)
     except ApiException as e:
         assert e.status == 400
     # 获取otc法币余额,币币余额
     after_res1 = otc_balance_api.balance_info_currency_id_get(
         currency_id=coin_id)
     assert round(float(after_res1.available),
                  8) == round(float(before_res1.available), 8)
     after_res2 = otc_asset_api.asset_mgmt_assets_coin_id_get(
         coin_id=coin_id)
     assert round(float(after_res2.balance),
                  8) == round(float(before_res2.balance), 8)
Esempio n. 4
0
 def test_invite_success(self, platform, with_login):
     # 验证主平台,后台登录状态
     staff_token = get_admin_token()
     set_login_status(staff_acmanager_api, staff_token)
     register_with_login(platform, with_login,
                         [main_ac_api, main_invite_api])
     # 绑定登录user1与api
     # 获取主平台登录账户account_id,邀请码
     user1_acinfo_res = main_ac_api.accounts_account_info_get()
     user1_account_id = user1_acinfo_res.account_info.account_id
     print('user1账户id:', user1_account_id)
     # user2用user1的邀请码注册账号,登录成功
     manager = PlatformManager(platform)
     user2_ran_email = rand_email()
     print('user2邮箱:', user2_ran_email)
     ran_password = rand_password()
     ran_country = random_get_country_ob()["k"]
     try:
         manager.register(email=user2_ran_email,
                          password=ran_password,
                          promotion_code='321564',
                          nationality_code=ran_country,
                          nick_name=faker.name())
     except ApiException as e:
         assert e.status == 400
def individual_verify(platform: str,
                      id_number: str,
                      token,
                      verify_status: str = "ACCEPTED",
                      reject_type: str = str()):
    """
    申请个人实名审核以及通过通过指定证件id下的所有待审核的认证(供其他人调用)
    :param reject_type: 失败类型 [ INDIVIDUAL_ID,
                                 INDIVIDUAL_PASSPORT, ENTERPRISE_LOGO,
                                 ENTERPRISE_LICENSE, INDIVIDUAL_ABNORMAL,
                                 ENTERPRISE_ABNORMAL, USER_REPORT_ABNORMAL ]
    :param verify_status: 验证状态approved(通过)、disapproved(未通过)
    :param token: 用户登录token
    :param platform: 平台类型 Enum("main", "sponsor", "staff",
                                    "tenant", "venture")
    :param id_number: 证件号码
    """
    manager = PlatformManager(platform)
    manager.apply_individual_verify(id_number, token)
    admin_token = get_admin_token()
    audit_api = AuditApi()
    audit_api.api_client.set_default_header("Authorization",
                                            "Bearer " + admin_token)
    apply_list = get_individual_apply_list(audit_api, id_number)
    for apply_id in apply_list:
        handle_individual_apply(audit_api, apply_id, verify_status,
                                reject_type)
Esempio n. 6
0
    def test_exchange_post(self, with_login):
        exchange_api = ExchangeManagementApi()
        user = self.data['user']
        email, password = user['email'], user['password']
        token = with_login('tenant', [exchange_api], email, password)
        id_number = get_random_id_number()
        individual_verify('tenant', id_number, token)
        e = Exchange(exchange_api, token)
        exchange = e.get_exchange()
        exchange_api.exchange_post(exchange)
        rv = exchange_api.exchange_exchange_status_get()
        assert rv.status == 'pending'
        # 初审
        audit_api = AuditApi()
        uid = self.data['account_id']
        admin_token = get_admin_token()
        set_login_status(audit_api, admin_token)
        rv = audit_api.tenant_audits_get(uid=uid,
                                         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='ENTERPRISE_LICENSE')
        audit_api.tenant_audits_audit_post(res)
        # 复审
        res = PostTenantReAuditRequest(id=task_id,
                                       status='disapproved',
                                       failure_type=1)
        audit_api.tenant_audits_re_audit_post(res)

        rv = exchange_api.exchange_exchange_status_get()
        assert rv.status == 'disapproved'
Esempio n. 7
0
 def test_get_coin_config(self):
     (coin_id, coin_id_, coin_name, rc_confirmed_time,
      wc_confirmed_time) = create_venture()
     admin_token = get_admin_token()
     api = AssetManagementApi()
     set_login_status(api, admin_token)
     # 设置充提币
     api.asset_mgmt_coins_id_recharge_put(id=coin_id, rechargeable=True)
     api.asset_mgmt_coins_id_withdraw_put(id=coin_id, withdrawable=True)
     # 获取币种列表
     res = api.asset_mgmt_coins_get(coin_name=coin_name)
     assert len(res.items) == 1
     coin_config = res.items.pop()
     assert coin_config.coin_name == coin_name.upper()
     assert coin_config.coin_id == coin_id_
     assert coin_config.id == coin_id
     assert coin_config.rechargeable
     assert coin_config.withdrawable
     assert coin_config.initialized
     # 通过id获取币种配置
     res = api.asset_mgmt_coins_id_get(id=coin_id)
     assert res.id == coin_id
     # 获取币种提示信息
     api.asset_mgmt_coins_id_prompt_get(id=coin_id)
     # 修改币种提示信息
     api.asset_mgmt_coins_id_prompt_put(id=coin_id,
                                        body={"prompt": "prompt"})
     # 获取币种提示信息
     res = api.asset_mgmt_coins_id_prompt_get(id=coin_id)
     assert res.prompt == "prompt"
Esempio n. 8
0
 def test_revenue(self):
     admin_token = get_admin_token()
     api = AssetManagementApi()
     set_login_status(api, admin_token)
     res = api.asset_mgmt_revenue_get(coin_id="1")
     assert res.meta.requested_page == 1
     assert res.query.coin_id == "1"
def company_verify(platform: str,
                   social_number: str,
                   token,
                   verify_status: str = "ACCEPTED",
                   reject_type: str = str()):
    """
    申请公司实名审核以及通过通过指定社会统一编号下的所有待审核的认证(供其他人调用)
    :param reject_type: 失败类型 [ INDIVIDUAL_ID,
                                 INDIVIDUAL_PASSPORT, ENTERPRISE_LOGO,
                                 ENTERPRISE_LICENSE, INDIVIDUAL_ABNORMAL,
                                 ENTERPRISE_ABNORMAL, USER_REPORT_ABNORMAL ]
    :param verify_status: 验证状态ACCEPTED(通过)、REJECTED(未通过)
    :param platform:平台类型 Enum("main", "sponsor", "staff",
                                    "tenant", "venture")
    :param social_number: 社会统一编号
    :param token: 用户登录token
    """
    manager = PlatformManager(platform)
    manager.apply_company_verify(social_number, token)
    admin_token = get_admin_token()
    audit_api = AuditApi()
    audit_api.api_client.set_default_header("Authorization",
                                            "Bearer " + admin_token)
    rv = audit_api.accounts_company_audits_tasks_audit_num_get()
    assert rv.pending_num >= 1
    apply_list = get_company_apply_list(audit_api, social_number)
    for apply_id in apply_list:
        handle_company_apply(audit_api, apply_id, verify_status, reject_type)
Esempio n. 10
0
 def test_sponsors_case4(self):
     faker = Faker()
     # 创建保健方账号
     staff_api = SponsorsManagermentApi()
     staff_token = get_admin_token()
     set_login_status(staff_api, staff_token)
     sponsor = {
         "account": get_random_name(6, 25),
         "password": faker.password(),
         "name": faker.user_name(),
         "email": faker.email(),
         "phone": faker.phone_number()
     }
     staff_api.staff_sponsors_post(post_sponsor=sponsor)
     # 管理后台获取保健列表
     res = staff_api.staff_sponsors_get(page=1, name=sponsor.get("name"))
     sponsor_id = ''
     assert res.meta.total_count == 1
     for item in res.items:
         assert item.account == sponsor.get("account")
         assert item.email == sponsor.get("email")
         assert item.name == sponsor.get("name")
         assert item.status is True
         sponsor_id = item.id
     # 修改保荐方状态
     payload = {'id': sponsor_id, 'status': False}
     staff_api.staff_sponsor_status_put(put_sponsor_status=payload)
     # 获取保荐方列表
     res = staff_api.staff_sponsors_get(page=1)
     for item in res.items:
         if item.name == sponsor.get("name"):
             assert item.account == sponsor.get("account")
             assert item.email == sponsor.get("email")
             assert item.status is False
             assert item.id
Esempio n. 11
0
    def test_exchange_post(self, with_login):
        user = self.data['user']
        exchange_api = ExchangeManagementApi()
        email, password = user['email'], user['password']
        token = with_login('tenant', [exchange_api], email, password)
        id_number = get_random_id_number()
        individual_verify('tenant', id_number, token)
        e = Exchange(exchange_api, token)
        exchange = e.get_exchange()
        exchange_api.exchange_post(exchange)
        rv = exchange_api.exchange_exchange_status_get()
        assert rv.status == 'pending'
        audit_api = AuditApi()
        uid = self.data['account_id']
        admin_token = get_admin_token()
        set_login_status(audit_api, admin_token)
        rv = audit_api.tenant_audits_get(uid=uid,
                                         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='ENTERPRISE_LICENSE')
        audit_api.tenant_audits_audit_post(res)
        # 复审
        res = PostTenantReAuditRequest(id=task_id,
                                       status='approved',
                                       failure_type='ENTERPRISE_LICENSE')
        audit_api.tenant_audits_re_audit_post(res)

        rv = exchange_api.exchange_exchange_status_get()
        assert rv.status == 'approved'
        rv = exchange_api.exchange_exchange_id_get()
        exchange_id = rv.id
        TestExchange10.data['exchange_id'] = exchange_id
        TestExchange10.data['exchange'] = exchange
        # 用另外一个账号再创建一个交易所
        manager = PlatformManager('tenant')
        account_api = AccountApi()
        api = manager.account_api
        verify_api = manager.verify_api
        user = register_with_login('tenant', with_login,
                                   [api, verify_api, account_api])
        token1 = user['token']
        id_number = get_random_id_number()
        individual_verify('tenant', id_number, token1)
        exchange1 = e.get_exchange()
        exchange_api.exchange_get()
        name_used = exchange1.name
        # 用已有的交易所名称更新前一个交易所
        r = GetExchangeRequest(name=name_used)
        try:
            exchange_api.exchange_put(r)
        except ApiException as e:
            assert e.status == 400
        else:
            assert False, '交易所名称已经注册'
Esempio n. 12
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
 def test_no_exist_company(self):
     api = account_management_api.AccountManagementApi()
     admin_token = get_admin_token()
     api.api_client.set_default_header("Authorization",
                                       "Bearer " + admin_token)
     try:
         api.accounts_id_company_get(id="500000")
     except ApiException as e:
         assert e.status == 404
     else:
         assert False, "获取不存在的账户企业认证, java接口异常"
Esempio n. 14
0
 def test_get_staff_info(self):
     api = staff_management_api.StaffManagementApi()
     admin_token = get_admin_token()
     api.api_client.set_default_header("Authorization",
                                       "Bearer " + admin_token)
     res = api.staffs_info_get()
     assert res.account == ADMIN_ACCOUNT
     assert isinstance(res.phone_number, str)
     assert isinstance(res.real_name, str)
     assert isinstance(res.id, str)
     assert isinstance(res.resource, list)
    def test_application_success(self, otc_business_user):
        """
        otc平台获取账户id,otc平台申请成为商家,后台管理获取申请列表,后台管理查看申请记录,后台管理审核申请
        """
        otc_business_user([otc_buss_api, otc_ac_api])
        return
        # 后台登录
        staff_token = get_admin_token()
        set_login_status(staff_buss_api, staff_token)
        set_login_status(staff_sys_api, staff_token)
        # ot平台获取账户id
        ac_info = otc_ac_api.accounts_account_info_get()
        assert ac_info
        ac_id = ac_info.account_info.account_id

        # otc平台申请成为商家
        otc_buss_api.biz_apply_post()
        biz_info = otc_buss_api.biz_info_get()
        assert biz_info.code == 1

        # otc平台查询押金信息
        otc_margin_res = otc_buss_api.biz_margin_info_get()
        logger.info(f'押金信息:{otc_margin_res}')

        # 后台管理获取申请列表
        application_rec = staff_buss_api.admin_biz_find_page_get(user_id=ac_id)
        order_num = application_rec.items[0].id
        logger.info(f'后台申请列表:{application_rec}')
        # 后台管理查看申请记录
        staff_biz_info = staff_buss_api.admin_biz_info_get(id=order_num)
        assert staff_biz_info.status == 1

        # 后台管理审核申请成功
        success_reaason = '您的信良好,继续保持'
        payload = AuditRequest(id=order_num,
                               status=2,
                               reason=success_reaason,
                               file_recved=1)
        staff_buss_api.admin_biz_audit_post(payload)

        # 检查后台查看申请记录
        staff_app_list = staff_buss_api.admin_biz_find_page_get(user_id=ac_id)
        order_id = staff_app_list.items[0].id
        assert staff_app_list.items[0].status == 2

        # 后台管理查看申请记录
        staff_biz_info2 = staff_buss_api.admin_biz_info_get(id=order_id)
        assert staff_biz_info2.status == 2
        # 检查otc平台结果
        biz_res = otc_buss_api.biz_info_get()
        assert biz_res and biz_res.code == 2
        assert biz_res.reason == success_reaason
Esempio n. 16
0
 def test_models_case11(self):
     # 后台登录
     content_api = ContentManagementApi()
     staff_token = get_admin_token()
     set_login_status(content_api, staff_token)
     # 新建文章模型
     payload = {
         'identification': get_random_name(2, 50),
         'name': get_random_name(2, 50),
         'status': True,
         'order': random.randint(1000, 9999),
         'type': 'kinmall'  # article文章,kinmall金猫
     }
     content_api.models_post(body=payload)
     # 获取文章模型列表
     models_id = ''
     page = 1
     res = content_api.models_get(type='kinmall', page=page)
     total_page = res.meta.total_page
     while page <= total_page:
         res = content_api.models_get(type='kinmall', page=page)
         for item in res.items:
             if item.name == payload['name']:
                 assert item.status is True
                 assert item.order == payload['order']
                 assert item.type == 'kinmall'
                 models_id = item.id
         page += 1
     # 新建子模型
     sub_payload = {
         "identification": get_random_name(2, 50),
         "name": get_random_name(2, 50),
         "status": True,
         "order": random.randint(1000, 9999),
         "modelId": models_id
     }
     content_api.sub_models_post(body=sub_payload)
     # 获取子模型列表
     id_ = ''
     res = content_api.sub_models_get(parent_id=models_id)
     for item in res.items:
         if item.name == sub_payload['name']:
             assert item.status is True
             assert item.order == sub_payload['order']
             id_ = item.id
     # 获取子模型详情
     res = content_api.sub_models_id_get(id=id_)
     assert res.name == sub_payload['name']
     assert res.status == sub_payload['status']
     assert res.order == sub_payload['order']
Esempio n. 17
0
 def test_post_tag(self):
     """创建tag"""
     api = WebsiteManagementApi()
     admin_token = get_admin_token()
     set_login_status(api, admin_token)
     res = PostExchangeTagsRequest()
     res.name = 'test_tag_' + str(random.randint(1, 10000))
     res.other_language = [
         {
             'key': '英语',
             'value': 'public_chain'
         }
     ]
     api.exchange_tags_post(res)
Esempio n. 18
0
    def test_exchange_post(self, with_login):
        exchange_api = ExchangeManagementApi()
        user = self.data['user']
        email, password = user['email'], user['password']
        token = with_login('tenant', [exchange_api], email, password)
        id_number = get_random_id_number()
        individual_verify('tenant', id_number, token)
        e = Exchange(exchange_api, token)
        exchange = e.get_exchange()
        exchange_api.exchange_post(exchange)
        rv = exchange_api.exchange_exchange_status_get()
        assert rv.status == 'pending'
        # 初审
        audit_api = AuditApi()
        admin_token = get_admin_token()
        set_login_status(audit_api, admin_token)
        uid = self.data['account_id']
        rv = audit_api.tenant_audits_get(uid=uid,
                                         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='ENTERPRISE_LICENSE')
        audit_api.tenant_audits_audit_post(res)
        # 复审
        res = PostTenantReAuditRequest(id=task_id,
                                       status='approved',
                                       failure_type='ENTERPRISE_LICENSE')
        audit_api.tenant_audits_re_audit_post(res)
        rv = exchange_api.exchange_exchange_status_get()
        assert rv.status == 'approved'
        rv = exchange_api.exchange_get()
        assert rv.name == exchange.name
        assert rv.logo_key == exchange.logo
        assert rv.email == exchange.email
        assert rv.nationality == exchange.nationality
        exchange.logo = img1
        exchange_api.exchange_put(exchange)
        rv = exchange_api.exchange_get()
        assert rv.name == exchange.name
        assert rv.logo_key == exchange.logo
        assert rv.email == exchange.email
        assert rv.nationality == exchange.nationality

        """合并测试用例"""
        """12.交易所审核通过——获取交易所ID——获取交易所买卖方币种列表"""
        coin = exchange_api.exchange_exchange_coin_get()
        assert coin.seller_coin == []
Esempio n. 19
0
    def test_exchange_post(self, with_login):
        audit_api = AuditApi()
        user = self.data['user']
        email = user['email']
        password = user['password']
        exchange_api = ExchangeManagementApi()
        token = with_login('tenant', [exchange_api], email, password)
        id_number = get_random_id_number()
        individual_verify('tenant', id_number, token)
        e = Exchange(exchange_api, token)
        exchange = e.get_exchange()
        exchange_api.exchange_post(exchange)

        admin_token = get_admin_token()
        set_login_status(audit_api, admin_token)
        # 初审
        uid = self.data['account_id']
        rv = audit_api.tenant_audits_get(uid=uid,
                                         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 = exchange_api.exchange_exchange_status_get()
        assert rv.status == 'approved'
        try:
            user1 = self.data['user1']
            email1, password1 = user1['email'], user1['password']
            exchange_api1 = ExchangeManagementApi()
            token1 = with_login('tenant', [exchange_api1], email1, password1)
            id_number = get_random_id_number()
            individual_verify('tenant', id_number, token1)
            # print(token1)
            exchange1 = e.get_exchange()
            exchange1.name = exchange.name
            # pprint(exchange1)
            exchange_api1.exchange_post(exchange1)
        except ApiException as e:
            assert e.status == 400
        else:
            assert False, '交易所名称重复不应当创建'
        assert exchange_name_verify(token, exchange.name), '交易所名称应当已经存在'
 def test_lock_no_exist_account(self):
     api = account_management_api.AccountManagementApi()
     admin_token = get_admin_token()
     api.api_client.set_default_header("Authorization",
                                       "Bearer " + admin_token)
     try:
         api.accounts_id_lock_account_put(id="20000",
                                          body={
                                              "isBlocked": True,
                                              "blockedReason": "填写的锁定原因"
                                          })
     except ApiException as e:
         assert e.status == 404
     else:
         assert False, "锁定不存在的账户"
Esempio n. 21
0
 def test_exchange_list(self):
     """1.前台申请交易所并审核成功——获取交易所列表——获取交易所详情"""
     # 获取交易所列表
     api = StaffExchangeManagementApi()
     admin_token = get_admin_token()
     set_login_status(api, admin_token)
     exchange_id = TestExchange10.data['exchange_id']
     res = api.exchanges_get(exchange_id=exchange_id)
     assert len(res.items) == 1
     exchange_name = TestExchange10.data['exchange'].name
     assert len(res.items) >= 1
     # 获取交易所详情
     rv = api.exchange_id_get(id=exchange_id)
     assert rv.exchange_name == exchange_name
     assert rv.exchange_id == exchange_id
Esempio n. 22
0
        def biz_apply():
            # 后台登录
            admin_token = get_admin_token()
            user_res_info["admin_token"] = admin_token
            set_login_status(staff_buss_api, admin_token)

            # 前端申请
            # 后端通过
            otc_buss_api.biz_apply_post()
            admin_biz_rec = staff_buss_api.admin_biz_find_page_get(user_id=user_res_info['account_id'])
            order_num = admin_biz_rec.items[0].id

            staff_buss_api.admin_biz_info_get(id=order_num)

            success_reaason = "您的信良好"
            payload = AuditRequest(id=order_num, status=2, reason=success_reaason, file_recved=1)
            staff_buss_api.admin_biz_audit_post(payload)
Esempio n. 23
0
    def test_exchange_post(self, with_login):
        audit_api = AuditApi()
        user = self.data['user']
        email = user['email']
        password = user['password']
        exchange_api = ExchangeManagementApi()
        e_api = ExchangeApi()
        f_api = FavoriteManagementApi()
        token = with_login('tenant',
                           [exchange_api, e_api, f_api],
                           email, password)
        id_number = get_random_id_number()
        individual_verify('tenant', id_number, token)
        e = Exchange(exchange_api, token)
        exchange = e.get_exchange()
        exchange_api.exchange_post(exchange)
        rv = exchange_api.exchange_exchange_status_get()
        assert rv.status == 'pending'
        admin_token = get_admin_token()
        set_login_status(audit_api, admin_token)
        # 初审
        uid = self.data['account_id']
        rv = audit_api.tenant_audits_get(uid=uid,
                                         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)
        # 初审详情
        rv = audit_api.tenant_audits_results_id_company_audit_get(task_id)
        assert rv.audit_status == 'approved'
        assert rv.uid == uid
        # 复审
        res = PostTenantReAuditRequest(id=task_id,
                                       status='disapproved')
        audit_api.tenant_audits_re_audit_post(res)
        # 复审详情
        rv = audit_api.tenant_audits_results_id_company_re_audit_get(task_id)
        assert rv.audit_status == 'approved'
        assert rv.uid == uid
        assert rv.re_status == 'disapproved'

        rv = exchange_api.exchange_exchange_status_get()
        assert rv.status == 'disapproved'
Esempio n. 24
0
    def test_exchange(self, with_login):
        manager = PlatformManager('tenant')
        account_api = AccountApi()
        api = manager.account_api
        verify_api = manager.verify_api
        user = register_with_login('tenant', with_login,
                                   [api, verify_api, account_api])
        # 绑定电话
        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)

        account_info = account_api.accounts_account_info_get()
        account_id = account_info.account_info.account_id
        id_number = get_random_id_number()
        individual_verify('tenant', id_number, user['token'])

        e_api = StaffExchangeManagementApi()
        a_api = AccountManagementApi()
        admin_token = get_admin_token()
        audit_api = AuditApi()
        set_login_status(audit_api, admin_token)
        set_login_status(e_api, admin_token)
        set_login_status(a_api, admin_token)
        # 用户列表
        rv = a_api.accounts_investors_get(account_id=account_id)
        assert rv.items

        # 后台开通交易所
        req = {
            "accountId": account_id,
            "area": "+86",
            "email": str(int(time.time())) + "@qq.com",
            "logo": "",
            "name": str(int(time.time())),
            "phone": "15548494655",
            "tags": ""
        }
        e_api.exchange_post(req)
        # 交易所审核列表
        rv = audit_api.tenant_audits_get(uid=account_id)
        item = rv.items[0]
        assert item.status == 'approved'
Esempio n. 25
0
 def test_investors(self, with_login):
     """3.前台已开通交易所——获取用户列表——获取账号信息详情"""
     api = AccountManagementApi()
     admin_token = get_admin_token()
     set_login_status(api, admin_token)
     a_api = AccountApi()
     user = self.data['user']
     email, password = user['email'], user['password']
     token = with_login('tenant', [a_api], email, password)
     account_info = a_api.accounts_account_info_get()
     account_id = account_info.account_info.account_id
     rv = api.accounts_investors_get(account_id=account_id)
     investors = rv.items
     assert len(investors) > 0
     rv = api.accounts_accounts_id_get(id=account_id)
     exchange_id = TestExchange10.data['exchange_id']
     assert rv.basic_info.exchange_id == exchange_id
Esempio n. 26
0
    def test_delete_role(self):
        api = security_management_api.SecurityManagementApi()
        # 未登录时,删除角色
        try:
            api.roles_id_delete(id="500000")
        except ApiException as e:
            assert e.status == 403
        else:
            assert False, "未登录时删除角色, java接口异常"

        admin_token = get_admin_token()
        api.api_client.set_default_header("Authorization",
                                          "Bearer " + admin_token)
        # 删除不存在的角色
        try:
            api.roles_id_delete(id="500000")
        except ApiException as e:
            assert e.status == 404
        else:
            assert False, "删除不存在的角色, java接口异常"

        # 正常创建删除角色
        faker = Faker()
        role_name = faker.name()
        resp = api.roles_post(body={
            "name": role_name,
            "description": "this is description of role"
        })
        role_id = resp.role_id
        api.roles_id_delete(id=role_id)
        # 通过获取角色信息来判断是否删除
        try:
            api.roles_id_get(id=role_id)
        except ApiException as e:
            assert e.status == 404
        else:
            assert False, "删除角色后还可以获取该角色详情"

        # 重复删除
        try:
            api.roles_id_delete(id=role_id)
        except ApiException as e:
            assert e.status == 404
        else:
            assert "删除已删除的角色时, java接口异常"
Esempio n. 27
0
 def test_sponsor_account_case2(self):
     faker = Faker()
     # 创建保健方账号
     staff_api = SponsorsManagermentApi()
     staff_token = get_admin_token()
     set_login_status(staff_api, staff_token)
     sponsor = {"account": get_random_name(6, 50), "password": faker.password(),
                "name": faker.user_name(), "email": faker.email(),
                "phone": faker.phone_number()}
     staff_api.staff_sponsors_post(post_sponsor=sponsor)
     # 极验初始化
     verification_api = VerificationApi()
     challenge = ''
     res = verification_api.accounts_init_captcha_get()
     assert res.new_captcha == 'true'
     assert res.success == '1'
     challenge = res.challenge
     # 获取绑定的手机和邮箱
     api = SponsorApi()
     api.sponsor_info_post(sponsor_info={"userName": sponsor['account'],
                                         "challenge": challenge,
                                         "seccode": "fdhfghfdghfghfjhfghfasfas",
                                         "validate": "dfhdfgdfgfdgfdgsadfasfas"})
     # 二次验证
     base_token = ''
     res = api.sponsor_verify_post(post_verify_request={"userName": sponsor['account'],
                                                        "uri": "mailto:" + str(sponsor['email']),
                                                        "code": "666666",
                                                        "type": "forget_pwd"})
     base_token = res.base_token
     # 重置密码
     set_password = {"password": faker.password()}
     api.sponsor_set_password_post(sponsor_rest_pwd={"userName": sponsor['account'],
                                                     "baseToken": base_token,
                                                     "password": set_password['password']})
     # 保荐方登录
     sponsor_api = SponApi()
     get_sponsor_token(account=sponsor.get("account"),
                       password=set_password.get("password"),
                       email=sponsor.get("email"), api_list=[sponsor_api, api])
     # 获取保荐方排行榜
     res = sponsor_api.sponsors_ranking_get(page=1)
     assert res.ranking == res.meta.total_count
     # 保荐方退出
     api.sponsor_logout_post()
 def test_no_individual_account(self, platform, with_login):
     api = account_management_api.AccountManagementApi()
     admin_token = get_admin_token()
     api.api_client.set_default_header("Authorization",
                                       "Bearer " + admin_token)
     user = register_with_login(platform, with_login, [])
     email = user["email"]
     # 通过列表获取账户id
     investors_resp = api.accounts_investors_get(email=user["email"])
     account = investors_resp.items.pop()
     assert account.email == email
     user_id = account.uid
     try:
         api.accounts_id_individual_get(id=user_id)
     except ApiException as e:
         assert e.status == 404
     else:
         assert False
Esempio n. 29
0
 def test_error_create_staff(self):
     """测试不填写电话和邮箱创建职员"""
     api = staff_management_api.StaffManagementApi()
     admin_token = get_admin_token()
     api.api_client.set_default_header("Authorization",
                                       "Bearer " + admin_token)
     faker = Faker()
     account = faker.user_name()
     real_name = faker.name()
     try:
         api.staffs_post(body={
             "account": account,
             "realName": real_name}
         )
     except ApiException as e:
         assert e.status == 400
     else:
         assert False, "未填写电话和邮箱进行创建职员, java接口异常"
Esempio n. 30
0
 def test_sponsors_case5(self):
     faker = Faker()
     manager = PlatformManager("venture")
     email = random_email()
     password = faker.password()
     country = random_get_country_ob()
     manager.register(email=email,
                      password=password,
                      promotion_code=None,
                      verification_code="666666",
                      nationality_code=country.get("k"))
     token = manager.login(account=email, password=password)
     # 个人实名认证
     individual_verify(platform="venture",
                       id_number=get_random_id_number(),
                       token=token)
     # 创建保健方账号
     staff_api = SponsorsManagermentApi()
     staff_token = get_admin_token()
     set_login_status(staff_api, staff_token)
     sponsor = {
         "account": get_random_name(6, 25),
         "password": faker.password(),
         "name": faker.user_name(),
         "email": email,
         "phone": faker.phone_number()
     }
     staff_api.staff_sponsors_post(post_sponsor=sponsor)
     # 管理后台获取保健列表
     res = staff_api.staff_sponsors_get(page=1, name=sponsor.get("name"))
     assert res.meta.total_count == 1
     for item in res.items:
         assert item.account == sponsor.get("account")
         assert item.email == sponsor.get("email")
         assert item.name == sponsor.get("name")
         assert item.status is True
         assert item.id
     # 项目方获取保健列表
     venture_api = SMApi()
     set_login_status(venture_api, token)
     res = venture_api.sponsors_get(page=1, name=sponsor.get("name"))
     item = res.items.pop()
     assert item.name == sponsor.get("name")
     assert item.id