示例#1
0
    def test_register(self, with_login):
        account_api = AccountApi()
        manager = PlatformManager('tenant')
        api = manager.account_api
        verify_api = manager.verify_api
        user = register_with_login('tenant', with_login, [api, verify_api, account_api])
        self.data['user'] = user
        account_info = account_api.accounts_account_info_get()
        account_id = account_info.account_info.account_id
        self.data['account_id'] = account_id
        # 绑定电话
        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)

        user1 = register_with_login('tenant', with_login, [api, verify_api])
        self.data['user1'] = user1
        # 绑定电话
        email1 = user1.get('email')
        phone1 = faker.phone_number()
        verify = verify_info(manager, email1, "bind_phone")
        manager.bind_phone(phone1, DEFAULT_VERIFY_CODE,
                           area_code="+86", token=verify.token)
示例#2
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
示例#3
0
    def test_withdraw_address(self, platform, with_login):
        manager = PlatformManager(platform)
        asset_api = manager.asset_api
        # 未登录获取提币地址
        try:
            asset_api.asset_mgmt_withdraw_addresses_get(coin_id="1")
        except manager.api_exception as e:
            assert e.status == 403
        else:
            assert False, "未登录获取提币地址, java接口异常"

        # 未添加获取提币地址
        register_with_login(platform, with_login, [asset_api])
        res = asset_api.asset_mgmt_withdraw_addresses_get(coin_id="1")
        assert not res

        # 添加提币地址后获取提币地址
        asset_api.asset_mgmt_withdraw_addresses_post(
            body={
                "coinId": "1",
                "remark": "remark",
                "address": "new_withdraw_address"
            })
        res = asset_api.asset_mgmt_withdraw_addresses_get(coin_id="1")
        withdraw_address = res.pop()
        assert withdraw_address["coinId"] == "1"
        assert withdraw_address["remark"] == "remark"
        assert withdraw_address["address"] == "new_withdraw_address"
        address_id = withdraw_address["id"]
        asset_api.asset_mgmt_withdraw_addresses_id_put(id=address_id)
        res = asset_api.asset_mgmt_withdraw_addresses_get(coin_id="1")
        assert not res
示例#4
0
 def test_normal_get_asset(self, platform, with_login):
     manager = PlatformManager(platform)
     asset_api = manager.asset_api
     register_with_login(platform, with_login, [asset_api])
     res = asset_api.asset_mgmt_assets_get()
     assert isinstance(res.asset_info, list)
     assert isinstance(res.estimates.usdt, str)
     assert isinstance(res.estimates.cny, str)
 def test_no_exit_get_individual_info(self, platform, with_login):
     manager = PlatformManager(platform)
     account_api = manager.account_api
     register_with_login(platform, with_login, [account_api])
     try:
         account_api.accounts_individual_get()
     except manager.api_exception as e:
         assert e.status == 404
     else:
         assert False, "账号不存在个人认证申请时获取个人认证信息,java接口异常"
 def test_get_no_exit_account_company(self, platform, with_login):
     manager = PlatformManager(platform)
     account_api = manager.account_api
     register_with_login(platform, with_login, [account_api])
     try:
         account_api.accounts_company_get()
     except manager.api_exception as e:
         assert e.status == 404
     else:
         assert False, "账号不存在企业申请时获取企业信息,java接口异常"
示例#7
0
 def test_error_field_recharge_address(self, platform, with_login):
     manager = PlatformManager(platform)
     asset_api = manager.asset_api
     register_with_login(platform, with_login, [asset_api])
     try:
         asset_api.asset_mgmt_recharge_addresses_get(coin_id=1)
     except manager.api_exception as e:
         assert e.status == 400
     else:
         assert False, "获取指定币种的冲币地址时填写错误类型的币种id, java接口异常"
示例#8
0
 def test_normal_get_coin_info(self, platform, with_login):
     manager = PlatformManager(platform)
     asset_api = manager.asset_api
     register_with_login(platform, with_login, [asset_api])
     try:
         asset_api.asset_mgmt_coins_coin_id_get("500")
     except manager.api_exception as e:
         assert e.status == 404
     else:
         assert False, "获取不存在的币种信息时,java接口报错"
示例#9
0
 def test_normal_get_withdraw_history(self, platform, with_login):
     manager = PlatformManager(platform)
     asset_api = manager.asset_api
     register_with_login(platform, with_login, [asset_api])
     res = asset_api.asset_mgmt_withdraw_records_get()
     assert res.meta.requested_page == 1
     assert res.meta.total_page == 0
     # assert not res.query.status
     # assert not res.query.coin_id
     assert res.items == list()
示例#10
0
 def test_normal_init_google(self, platform, with_login):
     manager = PlatformManager(platform)
     verify_api = manager.verify_api
     register_with_login(platform, with_login, api_list=[verify_api])
     res = manager.init_google()
     assert isinstance(res.uri, str)
     assert isinstance(res.key, str)
     res = manager.init_google()
     assert isinstance(res.uri, str)
     assert isinstance(res.key, str)
示例#11
0
 def test_normal_get_incoming_history(self, platform, with_login):
     manager = PlatformManager(platform)
     asset_api = manager.asset_api
     register_with_login(platform, with_login, [asset_api])
     res = asset_api.asset_mgmt_journals_get()
     assert res.meta.total_page == 0
     assert res.meta.requested_page == 1
     assert res.meta.page == 1
     assert not res.query.subject_type
     assert not res.query.coin_id
     assert res.items == list()
示例#12
0
 def test_get_no_exist_withdraw_history(self, platform, with_login):
     manager = PlatformManager(platform)
     asset_api = manager.asset_api
     register_with_login(platform, with_login, [asset_api])
     res = asset_api.asset_mgmt_withdraw_records_get(page=100,
                                                     page_size=100,
                                                     coin_id="1",
                                                     status="CONFIRMING")
     assert res.meta.requested_page == 100
     assert res.meta.total_page == 0
     assert res.query.status == "CONFIRMING"
     assert res.query.coin_id == "1"
     assert res.items == list()
示例#13
0
    def test_incorrect_field_google(self, with_login, platform):
        manager = PlatformManager(platform)
        account_api = manager.account_api
        verify_api = manager.verify_api
        user = register_with_login(platform, with_login,
                                   [account_api, verify_api])
        email = user["email"]
        # 绑定谷歌验证器
        verify = verify_info(manager, email, "bind_google")
        try:
            account_api.accounts_bind_google_authenticator_post(
                word={
                    "googleCode": 123456,
                    "token": verify.token
                })
        except manager.api_exception as e:
            assert e.status == 400
        else:
            assert False, "绑定谷歌时填写错误类型的验证码,java接口异常"

        # 修改谷歌验证器
        verify = verify_info(manager, email, "alter_google")
        try:
            manager.alter_google("666666", verify.token)
        except manager.api_exception as e:
            assert e.status == 400
        else:
            assert False, "未绑定谷歌验证时调用修改谷歌验证,java接口异常"
示例#14
0
 def test_normal_get_single_balance(self, platform, with_login):
     manager = PlatformManager(platform)
     asset_api = manager.asset_api
     try:
         asset_api.asset_mgmt_balance_coin_id_get(coin_id="1")
     except manager.api_exception as e:
         assert e.status == 403
     else:
         assert False, "未登录获取单个币种余额,java接口异常"
     register_with_login(platform, with_login, [asset_api])
     try:
         asset_api.asset_mgmt_balance_coin_id_get(coin_id="1")
     except manager.api_exception as e:
         assert e.status == 404
     else:
         assert False, "获取不存在的单个币种余额, java接口异常"
示例#15
0
    def test_favorite_project_case6(self, with_login):
        user = register_with_login('main', with_login, [favorite_api])
        # 个人实名认证
        individual_verify(platform="main",
                          id_number=get_random_id_number(),
                          token=user["token"])

        # 主平台获取项目列表
        set_login_status(favorite_api, user["token"])
        res = main_api.projects_get(page=1, sort_key="volume", limit=100)
        main_project_id = ''
        for item in res.items:
            main_project_id = item.project_id
        # 收藏列表
        res = favorite_api.favorites_projects_get(page=1)
        assert res.meta.total_count == 0
        # 收藏
        payload = {'projectId': main_project_id}
        favorite_api.favorites_projects_post(body=payload)
        # 收藏列表
        res = favorite_api.favorites_projects_get(page=1)
        assert res.meta.total_count == 1
        for item in res.items:
            assert item.project_id == main_project_id
            assert item.id
            assert item.full_name
            assert item.project_name
            assert item.short_name
        # 判断是否收藏
        res = favorite_api.favorites_projects_is_favorite_get(
            project_id=main_project_id)
        assert res.status is True
        assert res.id
 def test_sample_get_account_info(self, platform, with_login):
     manager = PlatformManager(platform)
     account_api = manager.account_api
     user = register_with_login(platform, with_login, [account_api])
     email = user.get("email")
     country = user.get("country_abbreviation")
     password = user.get("password")
     res = account_api.accounts_account_info_get()
     print(res)
     assert isinstance(res.account_info.account_id, str)
     assert res.account_info.email == email
     assert res.account_info.nationality_code == country
     # assert isinstance(res.account_info.venture_id, str)
     # assert isinstance(res.account_info.tenant_id, str)
     # assert isinstance(res.account_info.investor_id, str)
     assert not res.account_info.phone_number
     assert isinstance(res.account_info.created_at, datetime)
     # assert res.security_verification.login_password == password
     # assert res.security_verification.tra_password == "false"
     assert not res.account_info.google_authenticator
     assert res.certification_audit.certification_status == "none"
     assert not res.certification_audit.certification_type
     assert not res.certification_audit.rejected_type
     assert not res.certification_audit.rejected_reason
     assert not res.certification_audit.application_date
     assert not res.certification_audit.certificat_name
示例#17
0
    def test_open_no_auth(self, with_login, platform):
        manager = PlatformManager(platform)
        account_api = manager.account_api
        user = register_with_login(platform, with_login, [account_api])
        email = user.get("email")
        res = account_api.accounts_get_bind_status_get()
        assert res.google_authenticator == TURN_OFF
        assert res.phone_authenticator == TURN_OFF
        assert res.email_authenticator == TURN_ON

        # 开启谷歌验证
        try:
            manager.open_google(DEFAULT_VERIFY_CODE)
        except manager.api_exception as e:
            assert e.status == 400
        else:
            assert False, "未绑定google,开启google验证,java接口异常"
        res = account_api.accounts_get_bind_status_get()
        assert res.google_authenticator == TURN_OFF
        assert res.phone_authenticator == TURN_OFF
        assert res.email_authenticator == TURN_ON

        # 开启电话验证
        try:
            manager.open_phone(DEFAULT_VERIFY_CODE)
        except manager.api_exception as e:
            assert e.status == 400
        else:
            assert False, "未绑定电话, 开启电话验证, java接口异常"
        res = account_api.accounts_get_bind_status_get()
        assert res.google_authenticator == TURN_OFF
        assert res.phone_authenticator == TURN_OFF
        assert res.email_authenticator == TURN_ON

        # 关闭谷歌验证
        try:
            manager.close_google(email, DEFAULT_VERIFY_CODE,
                                 DEFAULT_VERIFY_CODE)
        except manager.api_exception as e:
            assert e.status == 400
        else:
            assert False, "未绑定谷歌验证, 关闭谷歌验证, java接口异常"
        res = account_api.accounts_get_bind_status_get()
        assert res.google_authenticator == TURN_OFF
        assert res.phone_authenticator == TURN_OFF
        assert res.email_authenticator == TURN_ON

        # 关闭电话验证
        try:
            manager.close_phone(email, DEFAULT_VERIFY_CODE,
                                DEFAULT_VERIFY_CODE)
        except manager.api_exception as e:
            assert e.status == 400
        else:
            assert False, "未绑定电话验证, 关闭电话验证, java接口异常"
        res = account_api.accounts_get_bind_status_get()
        assert res.google_authenticator == TURN_OFF
        assert res.phone_authenticator == TURN_OFF
        assert res.email_authenticator == TURN_ON
 def test_normal_login_history(self, platform, with_login):
     manager = PlatformManager(platform)
     account_api = manager.account_api
     register_with_login(platform, with_login, [account_api])
     res = account_api.accounts_get_login_history_get()
     assert len(res.items) > 0
     item = res.items.pop()
     assert isinstance(item.id, str)
     assert isinstance(item.login_at, str)
     assert isinstance(item.location, str)
     assert isinstance(item.ip, str)
     assert isinstance(item.equipment_type, str)
     assert isinstance(item.access_side, str)
     assert res.meta.requested_page == 1
     assert res.meta.page == 1
     res = account_api.accounts_get_login_history_get(page=2)
     assert len(res.items) == 0
示例#19
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, '交易所名称已经注册'
    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
 def test_get_normal_individual_info(self, platform, with_login):
     manager = PlatformManager(platform)
     account_api = manager.account_api
     user = register_with_login(platform, with_login, [account_api])
     id_number = get_random_id_number()
     individual_verify(platform, id_number, token=user["token"])
     res = account_api.accounts_individual_get()
     assert res.number[:2] == id_number[:2]
     assert res.number[-2:] == id_number[-2:]
示例#22
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_get_normal_account_company(self, platform, with_login):
     manager = PlatformManager(platform)
     account_api = manager.account_api
     user = register_with_login(platform, with_login, [account_api])
     social_number = get_random_id_number()
     company_verify(platform, social_number=social_number,
                    token=user["token"])
     res = account_api.accounts_company_get()
     assert res.social_code[:2] == social_number[:2]
     assert res.social_code[-2:] == social_number[-2:]
 def test_error_field_apply_individual(self, platform, with_login):
     manager = PlatformManager(platform)
     account_api = manager.account_api
     register_with_login(platform, with_login, [account_api])
     try:
         # manager.apply_individual_verify(123456)
         country = random_get_country_ob()["k"]
         account_api.request_individual_certification(
             body={"nationalityCode": country,
                   "name": get_random_name(2, 20),
                   "type": "identityCard",
                   "number": 123456,
                   "frontPhoto": "front_phone",
                   "backPhoto": "back_photo",
                   "handheldPhoto": "handheld_photo"})
     except manager.api_exception as e:
         assert e.status == 400
     else:
         assert False, "填写错误类型字段进行个人实名认证,java接口异常"
 def test_normal_apply_company(self, platform, with_login):
     manager = PlatformManager(platform)
     account_api = manager.account_api
     register_with_login(platform, with_login, [account_api])
     id_number = get_random_id_number()
     company_info = manager.apply_company_verify(id_number)
     res = account_api.accounts_company_get()
     assert res.name[:1] == company_info["name"][:1]
     assert res.name[-1:] == company_info["name"][-1:]
     assert res.company_name == company_info["company_name"]
     assert res.phone_number[:3] == company_info["phone"][:3]
     assert res.phone_number[-4:] == company_info["phone"][-4:]
     assert res.social_code[:2] == id_number[:2]
     assert res.social_code[-2:] == id_number[-2:]
     account_info = account_api.accounts_account_info_get()
     status = account_info.certification_audit.certification_status
     assert status == "applied"
     type_ = account_info.certification_audit.certification_type
     assert type_ == "company"
 def test_normal_reset_password(self, platform, with_login):
     manager = PlatformManager(platform)
     account_api = manager.account_api
     verify_api = manager.verify_api
     user = register_with_login(platform, with_login,
                                [account_api, verify_api])
     faker = Faker('zh_CN')
     new_password = faker.password()
     manager.reset_password(user.get("email"), new_password)
     token = manager.login(user.get("email"), new_password)
     assert isinstance(token, str)
 def test_no_login_change(self, platform, with_login):
     manager = PlatformManager(platform)
     user = register_with_login(platform, with_login, list())
     faker = Faker('zh_CN')
     new_password = faker.password()
     try:
         manager.change_password(user.get("email"), user.get("password"),
                                 new_password)
     except manager.api_exception as e:
         assert e.status == 403
     else:
         assert False, "未登录的用户进行修改密码,java接口异常"
 def test_normal_verify_password(self, platform, with_login):
     manager = PlatformManager(platform)
     account_api = manager.account_api
     verify_api = manager.verify_api
     user = register_with_login(platform, with_login,
                                [account_api, verify_api])
     manager.verify_password(user.get("password"))
     faker = Faker()
     try:
         manager.verify_password(faker.password())
     except manager.api_exception as e:
         assert e.status == 400
     else:
         assert False, "验证错误密码, java接口异常"
示例#29
0
    def test_bind_incorrect_field_phone(self, platform, with_login):
        manager = PlatformManager(platform)
        account_api = manager.account_api
        verify_api = manager.verify_api
        user = register_with_login(platform, with_login,
                                   [account_api, verify_api])
        res = account_api.accounts_get_bind_status_get()
        assert res.google_authenticator == TURN_OFF
        assert res.phone_authenticator == TURN_OFF
        assert res.email_authenticator == TURN_ON
        # 绑定电话
        verify = verify_info(manager, user["email"], "bind_phone")
        try:
            account_api.accounts_bind_phone_post(
                body={
                    "phoneNumber": 12345678,
                    "verificationCode": "666666",
                    "areaCode": "+86",
                    "token": verify.token
                })
        except manager.api_exception as e:
            assert e.status == 400
        else:
            assert False, "绑定电话时填写错误类型的电话java接口异常"

        # 绑定电话
        try:
            account_api.accounts_bind_phone_post(
                body={
                    "phoneNumber": "()??.,.@@@@",
                    "verificationCode": "666666",
                    "areaCode": "+86",
                    "token": verify.token
                })
        except manager.api_exception as e:
            assert e.status == 400
        else:
            assert False, "绑定电话时填写特殊字符的电话java接口异常"

        faker = Faker('zh_CN')
        changed_phone = faker.phone_number()
        # 修改电话
        verify = verify_info(manager, user["email"], "alter_phone")
        try:
            manager.alter_phone(changed_phone, DEFAULT_VERIFY_CODE, "+86",
                                verify.token)
        except manager.api_exception as e:
            assert e.status == 400
        else:
            assert False, "未绑定电话后调用修改电话接口,java接口异常"
示例#30
0
    def test_register(self, with_login):
        manager = PlatformManager('tenant')
        api = manager.account_api
        verify_api = manager.verify_api
        user = register_with_login('tenant', with_login, [api, verify_api])
        self.data['user'] = user

        # 绑定电话
        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)