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
def test_applications1(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) # 申请项目 project_name = get_random_name(2, 16) short_name = "H" + str(random.randint(10000, 99999)) full_name = get_random_name(2, 16) project_api = ProjectApi() set_login_status(project_api, token) pay = copy.deepcopy(dict(payload)) pay.update({ 'project_name': project_name, 'short_name': short_name, 'full_name': full_name }) req = ApplicationRequest(**pay) res = project_api.applications_post(body=req) project_apply_id = res.id # 创建保健方账号 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) # 项目方获取保健列表 venture_api = SMApi() set_login_status(venture_api, token) res = venture_api.sponsors_get(page=1, name=sponsor.get("name")) item = res.items.pop() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 查看项目申请列表 res = project_api.applications_get(page=1) project_id = '' for item in res.items: assert item.project_name == project_name assert item.fullname == full_name assert item.short_name == short_name assert item.status == 'under_review' project_id = item.id # 查看申请项目详情 res = project_api.applications_id_get(id=project_id) assert res.sponsor_id == sponsor_id assert res.sponsor_name == sponsor['name'] assert res.id == project_id assert res.project_name == project_name assert res.short_name == short_name assert res.full_name == full_name assert res.status == 'under_review'
def test_report4(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) # 申请项目 project_name = get_random_name(2, 16) short_name = "F" + str(random.randint(10000, 99999)) full_name = get_random_name(2, 16) project_api = ProjectApi() set_login_status(project_api, token) pay = copy.deepcopy(dict(payload)) pay.update({ 'project_name': project_name, 'short_name': short_name, 'full_name': full_name }) req = ApplicationRequest(**pay) res = project_api.applications_post(body=req) project_apply_id = res.id # 创建保健方账号 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) # 项目方获取保健列表 venture_api = SMApi() set_login_status(venture_api, token) res = venture_api.sponsors_get(page=1, name=sponsor.get("name")) item = res.items.pop() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 保健方登 # 保健项目 sponsor_api = SponsorsProjectApi() get_sponsor_token(account=sponsor.get("account"), password=sponsor.get("password"), email=sponsor.get("email"), api_list=[sponsor_api]) sponsor_api.projects_sponsor_put(put_project_sponsor_request={ "id": project_apply_id, "status": 1, "remark": "remark" }) # 获取项目列表 res = project_api.projects_get(page=1) audit_project_id = '' for item in res.items: assert item.project_name == project_name assert item.full_name == full_name assert item.short_name == short_name audit_project_id = item.project_id # 发送项目报告 report_api = ReportManagementApi() set_login_status(report_api, token) payload1 = { "title": "项目报告" + str(random.randint(1000, 9999)), "type": "daily", "report_url": "C:\pc\Desktop\wanshare.pdf", "project_id": audit_project_id } req = PostReportRequest(**payload1) report_api.reports_post(body=req) # 获取报告列表 res = report_api.reports_project_id_get(project_id=audit_project_id) assert res.meta.total_count == 1 for item in res.items: assert item.title == payload1['title'] assert item.type == payload1['type'] assert item.id
def test_applications(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) # 创建保荐方账号 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) # 保荐方登 sponsor_api = SponsorsProjectApi() get_sponsor_token(account=sponsor.get("account"), password=sponsor.get("password"), email=sponsor.get("email"), api_list=[sponsor_api]) # 保荐成功记录 res = sponsor_api.sponsor_record_success_get(page=1) assert not res.meta # 个人实名认证 individual_verify(platform="venture", id_number=get_random_id_number(), token=token) # 申请项目 project_name = get_random_name(2, 16) short_name = "Q" + str(random.randint(10000, 99999)) full_name = get_random_name(2, 16) project_api = ProjectApi() set_login_status(project_api, token) pay = copy.deepcopy(dict(payload)) pay.update({ 'project_name': project_name, 'short_name': short_name, 'full_name': full_name }) req = ApplicationRequest(**pay) res = project_api.applications_post(body=req) project_apply_id = res.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() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 保健方登 # 保健项目 sponsor_api = SponsorsProjectApi() get_sponsor_token(account=sponsor.get("account"), password=sponsor.get("password"), email=sponsor.get("email"), api_list=[sponsor_api]) sponsor_api.projects_sponsor_put(put_project_sponsor_request={ "id": project_apply_id, "status": 1, "remark": "remark" }) # 保荐成功记录 res = sponsor_api.sponsor_record_success_get(page=1) assert res.meta.total_count == 1
def test_applications2(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) # 申请项目 project_name = get_random_name(2, 16) short_name = "I" + str(random.randint(10000, 99999)) full_name = get_random_name(2, 16) project_api = ProjectApi() set_login_status(project_api, token) pay = copy.deepcopy(dict(payload)) pay.update({ 'project_name': project_name, 'short_name': short_name, 'full_name': full_name }) req = ApplicationRequest(**pay) res = project_api.applications_post(body=req) project_apply_id = res.id # 创建保健方账号 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) # 项目方获取保健列表 venture_api = SMApi() set_login_status(venture_api, token) res = venture_api.sponsors_get(page=1, name=sponsor.get("name")) item = res.items.pop() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 查看项目申请列表 res = project_api.applications_get(page=1) project_id = '' for item in res.items: assert item.project_name == project_name assert item.fullname == full_name assert item.short_name == short_name assert item.status == 'under_review' project_id = item.id # 查看申请项目详情 res = project_api.applications_id_get(id=project_id) assert res.sponsor_id == sponsor_id assert res.sponsor_name == sponsor.get("name") assert res.id == project_id assert res.project_name == project_name assert res.short_name == short_name assert res.full_name == full_name assert res.status == 'under_review' # 修改申请项目 project_name1 = '项目方' + str(random.randint(1000, 9999)) full_name1 = 'BitCoin' + str(random.randint(1000, 9999)) short_name1 = 'BTC' + str(random.randint(100, 999)) payload2 = { 'project_name': project_name1, 'description': 'XXXXXXXXXXXXXXXX', 'official_website': 'www.xxxx.com', 'white_paper_key': 'url/pdf123455', 'area_code': '+86', "project_poster_key": "123455", 'cellphone': '13510022445', 'telephone': '12874846', 'email': '*****@*****.**', 'full_name': full_name1, 'short_name': short_name1, 'issue_price': '2.24545', 'issued_volume': '1000000', 'circulation_volume': '1000000', "coin_logo_key": "456455", 'blockchain_type': 'public_chain', 'data_link': 'www.baidu.com', 'block_browser': 'www.baidu.com' } req = ApplicationRequest(**payload2) try: project_api.applications_id_put(id=project_id, body=req) except ApiException as apiexc: assert apiexc.status == 400 else: assert False
def test_applications19(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) # 申请项目 project_name = get_random_name(2, 16) short_name = "Y" + str(random.randint(10000, 99999)) full_name = get_random_name(2, 16) project_api = ProjectApi() set_login_status(project_api, token) pay = copy.deepcopy(dict(payload)) pay.update({ 'project_name': project_name, 'short_name': short_name, 'full_name': full_name }) req = ApplicationRequest(**pay) res = project_api.applications_post(body=req) project_apply_id = res.id # 创建保健方账号 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) # 项目方获取保健列表 venture_api = SMApi() set_login_status(venture_api, token) res = venture_api.sponsors_get(page=1, name=sponsor.get("name")) item = res.items.pop() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 保健方登 # 保健项目 sponsor_api = SponsorsProjectApi() get_sponsor_token(account=sponsor.get("account"), password=sponsor.get("password"), email=sponsor.get("email"), api_list=[sponsor_api]) sponsor_api.projects_sponsor_put(put_project_sponsor_request={ "id": project_apply_id, "status": 1, "remark": "remark" }) # 后台获取所有项目列表 staff_project = Sta_project() set_login_status(staff_project, token) res = staff_project.projects_get(project_name=project_name) up_project_name = '' for item in res.items: up_project_name = item.project_name # 申请项目 try: full_name1 = get_random_name(2, 16) short_name1 = get_random_name(2, 6) payload1 = { "project_name": project_name, "description": "{}-description".format(project_name), "official_website": "www.{}.com".format(project_name), "white_paper_key": "{}-whitePaper".format(project_name), "area_code": "+86", "project_poster_key": "123455", "cellphone": "123456789", "telephone": "12345678910", "email": faker.email(), "full_name": full_name1, "short_name": short_name1, "issue_price": "2.24545", "issued_volume": "1000000", "circulation_volume": "1000000", "issued_date": "2018-08-08", "coin_logo_key": "456455", "blockchain_type": "public_chain", "data_link": "{}-data-link".format(project_name), "block_browser": "{}-block-Browser".format(project_name) } req = ApplicationRequest(**payload1) project_api.applications_post(body=req) except ApiException as e: assert e.status == 400 message = json.loads(e.body)['message'] assert message == '项目名称已经存在' else: assert False
def test_applications8(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"), nick_name='fghfg') token = manager.login(account=email, password=password) # 个人实名认证 individual_verify(platform="venture", id_number=get_random_id_number(), token=token) # 申请项目 project_name = get_random_name(2, 16) short_name = "O" + str(random.randint(10000, 99999)) full_name = get_random_name(2, 16) project_api = ProjectApi() set_login_status(project_api, token) pay = copy.deepcopy(dict(payload)) pay.update({ 'project_name': project_name, 'short_name': short_name, 'full_name': full_name }) req = ApplicationRequest(**pay) res = project_api.applications_post(body=req) project_apply_id = res.id # 创建保健方账号 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) # 新建交易所标签 website_api = WebsiteManagementApi() set_login_status(website_api, staff_token) website = { "name": "交易所标签" + str(random.randint(10000, 99999)), "otherLanguage": [{ "key": "英语", "value": "public_chain" }, { "key": "法语", "value": "public_chain" }] } website_api.exchange_tags_post(body=website) # 项目方获取保健列表 venture_api = SMApi() set_login_status(venture_api, token) res = venture_api.sponsors_get(page=1, name=sponsor.get("name")) item = res.items.pop() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 保健方登 # 保健项目 sponsor_api = SponsorsProjectApi() get_sponsor_token(account=sponsor.get("account"), password=sponsor.get("password"), email=sponsor.get("email"), api_list=[sponsor_api]) sponsor_api.projects_sponsor_put(put_project_sponsor_request={ "id": project_apply_id, "status": 1, "remark": "remark" }) # 币种配置列表 asset_api = AssetManagementApi() set_login_status(asset_api, staff_token) res = asset_api.asset_mgmt_coins_get(page=1, coin_name=short_name) coin_id = '' assert res.meta.total_count == 1 for item in res.items: assert item.coin_name == short_name coin_id = item.id # 初始化币种配置 payload1 = { "usdtPrice": "1", "rcTimes": 0, "wcTimes": 0, "withdrawRate": "1", "minWithdrawFee": "1", "minWithdraw": "1", "maxWithdraw": "1", "dayWithdrawTotal": "1", "minRecharge": "1", "addressTagSwitch": True, "addressType": "1", "addressUrl": "1", "txidUrl": "1" } asset_api.asset_mgmt_coins_id_init_put(id=coin_id, body=payload1) # 授权登录 api = AccountApi() set_login_status(api, token) api.create_platform() # 提交交易所申请 exchange_api = ExchangeManagementApi() set_login_status(exchange_api, token) exchange = { "email": email, "logo": "gdfgdvdfvdf", "name": "交易所" + str(random.randint(10000, 99999)), "nationality": "+86", "phone": '+86135678' + str(random.randint(10000, 99999)), "tags": website['name'] } exchange_api.exchange_post(exchange) # 交易所账号审核列表 audit_api = AuditApi() set_login_status(audit_api, staff_token) res = audit_api.tenant_audits_get(exchange_name=exchange['name']) audit_id = '' for item in res.items: audit_id = item.id # 交易所初审 audit = { "failureType": "string", "id": audit_id, "isDataReceived": True, "status": "approved" } audit_api.tenant_audits_audit_post(body=audit) # 交易所账号审核列表 res = audit_api.tenant_audits_get(exchange_name=exchange['name']) re_audit_id = '' for item in res.items: re_audit_id = item.id # 交易所账号复审 re_audit = { "failureType": "string", "id": re_audit_id, "status": "approved" } audit_api.tenant_audits_re_audit_post(body=re_audit) # 获取交易所id exchange_id_ = '' res = exchange_api.exchange_exchange_id_get() exchange_id_ = res.id # 获取项目列表 exchange_project_api = ExchangeProject() set_login_status(exchange_project_api, token) project_id = '' res = exchange_project_api.projects_get(coin_name=short_name) for item in res.items: project_id = item.project_id # 申请对接 contacts_api = ExchangeContacts() set_login_status(contacts_api, token) contacts = { "exchangeId": exchange_id_, "projectId": project_id, "sponsor": "tenant" } contacts_api.contacts_post(contacts) # 获取项目未处理的邀请记录数量 contacts_project_api = ContactsApi() set_login_status(contacts_project_api, token) res = contacts_project_api.contacts_invite_number_get(id=project_id) assert res.result == '1' # 获取交易所对接的项目列表 api = ProjectManagementApi() set_login_status(api, token) contacts_id = '' res = api.projects_id_contacts_get(id=project_id, sponsor="pending") for item in res.items: if item.exchange_name == exchange['name']: contacts_id = item.contact_id # 处理对接邀请 payload2 = {"contactId": contacts_id, "status": "accepted"} contacts_project_api.contacts_put(body=payload2) # 判断项目方与交易所是否已经申请对接 res = contacts_project_api.contacts_check_get(project_id=project_id, exchange_id=exchange_id_) assert res.result
def test_applications4(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) # 申请项目 project_name = get_random_name(2, 16) short_name = "K" + str(random.randint(10000, 99999)) full_name = get_random_name(2, 16) project_api = ProjectApi() set_login_status(project_api, token) pay = copy.deepcopy(dict(payload)) pay.update({ 'project_name': project_name, 'short_name': short_name, 'full_name': full_name }) req = ApplicationRequest(**pay) res = project_api.applications_post(body=req) project_apply_id = res.id # 创建保健方账号 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) # 项目方获取保健列表 venture_api = SMApi() set_login_status(venture_api, token) res = venture_api.sponsors_get(page=1, name=sponsor.get("name")) item = res.items.pop() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 保健方登 # 保健项目 sponsor_api = SponsorsProjectApi() get_sponsor_token(account=sponsor.get("account"), password=sponsor.get("password"), email=sponsor.get("email"), api_list=[sponsor_api]) sponsor_api.projects_sponsor_put(put_project_sponsor_request={ "id": project_apply_id, "status": 1, "remark": "remark" }) # 获取项目列表 res = project_api.projects_get(page=1) audit_project_id = '' for item in res.items: assert item.project_name == project_name assert item.full_name == full_name assert item.short_name == short_name audit_project_id = item.project_id # 获取项目详情 res = project_api.projects_id_get(id=audit_project_id) assert res.sponsor_info.sponsor_name == sponsor.get("name") assert res.sponsor_info.sponsor_id assert res.project_info.project_name == project_name assert res.project_info.id assert res.coin_info.short_name == short_name assert res.coin_info.full_name == full_name assert res.coin_info.id # 修改项目信息 project_info1 = { "white_paper_key": "url/pdf123455", "official_website": "www.xxxx.com", "email": "*****@*****.**", "area_code": "+86", "cellphone": "13510022445", "telephone": "12874846", "project_poster_key": "url/image123455", "description": "以太坊(英文Ethereum)是一个开源的有智能合约功能的公共区块链平台" } communities = {'type': 'QQ', 'value': 'www.qq.com'} setting = {'open': True, 'access_method': 'accept'} data = PutProjectRequest() data.project_info = PutProjectRequestProjectInfo(**project_info1) data.setting = PutProjectRequestSetting(**setting) data.communities = [PutProjectRequestCommunities(**communities)] project_api.projects_id_put(id=audit_project_id, type='base', body=data) # 获取项目列表 res = project_api.projects_get(page=1) audit_project_id = '' for item in res.items: if item.project_name == project_name: audit_project_id = item.project_id # 获取项目详情 res = project_api.projects_id_get(id=audit_project_id) assert res.sponsor_info.sponsor_name == sponsor.get("name") assert res.sponsor_info.sponsor_id assert res.project_info.project_name == project_name assert res.project_info.id assert res.coin_info.short_name == short_name assert res.coin_info.full_name == full_name assert res.coin_info.id
def test_applications17(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) # 申请项目 project_name = get_random_name(2, 16) short_name = "W" + str(random.randint(10000, 99999)) full_name = get_random_name(2, 16) project_api = ProjectApi() set_login_status(project_api, token) pay = copy.deepcopy(dict(payload)) pay.update({ 'project_name': project_name, 'short_name': short_name, 'full_name': full_name }) req = ApplicationRequest(**pay) res = project_api.applications_post(body=req) project_apply_id = res.id # 创建保健方账号 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) # 项目方获取保健列表 venture_api = SMApi() set_login_status(venture_api, token) res = venture_api.sponsors_get(page=1, name=sponsor.get("name")) item = res.items.pop() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 保健方登 # 保健项目 sponsor_api = SponsorsProjectApi() get_sponsor_token(account=sponsor.get("account"), password=sponsor.get("password"), email=sponsor.get("email"), api_list=[sponsor_api]) sponsor_api.projects_sponsor_put(put_project_sponsor_request={ "id": project_apply_id, "status": 1, "remark": "remark" }) # 获取项目列表 res = project_api.projects_get(page=1) audit_project_id = '' for item in res.items: assert item.project_name == project_name assert item.full_name == full_name assert item.short_name == short_name audit_project_id = item.project_id # 获取项目详情 res = project_api.projects_id_get(id=audit_project_id) assert res.sponsor_info.sponsor_name == sponsor.get("name") assert res.sponsor_info.sponsor_id assert res.project_info.project_name == project_name assert res.project_info.id assert res.coin_info.short_name == short_name assert res.coin_info.full_name == full_name assert res.coin_info.id # 修改申请项目 payload1 = { "communities": [{ "type": "QQ", "value": "http://qq.com" }, { "type": "Facebook", "value": "http://Facebook.com" }, { "type": "twitter", "value": "http://www.twitter.com" }] } project_api.projects_id_put(id=audit_project_id, type="community", body=payload1) # 获取项目列表 res = project_api.projects_get(page=1) audit_project_id = '' for item in res.items: assert item.project_name == project_name assert item.full_name == full_name assert item.short_name == short_name audit_project_id = item.project_id # 获取项目详情 res = project_api.projects_id_get(id=audit_project_id) assert res.sponsor_info.sponsor_name == sponsor.get("name") assert res.sponsor_info.sponsor_id assert res.project_info.project_name == project_name assert res.project_info.id assert res.coin_info.short_name == short_name assert res.coin_info.full_name == full_name assert res.coin_info.id for ties in res.project_info.communities: assert ties.type in ('qq', 'facebook', 'twitter') assert ties.type in ties.value.lower()
def test_announcement3(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) # 申请项目 project_name = get_random_name(2, 16) short_name = "AQ" + str(random.randint(100, 999)) full_name = get_random_name(2, 16) project_api = ProjectApi() set_login_status(project_api, token) pay = copy.deepcopy(dict(payload)) pay.update({ 'project_name': project_name, 'short_name': short_name, 'full_name': full_name }) req = ApplicationRequest(**pay) res = project_api.applications_post(body=req) project_apply_id = res.id # 创建保健方账号 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) # 项目方获取保健列表 venture_api = SMApi() set_login_status(venture_api, token) res = venture_api.sponsors_get(page=1, name=sponsor.get("name")) item = res.items.pop() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 保健方登 # 保健项目 sponsor_api = SponsorsProjectApi() get_sponsor_token(account=sponsor.get("account"), password=sponsor.get("password"), email=sponsor.get("email"), api_list=[sponsor_api]) sponsor_api.projects_sponsor_put(put_project_sponsor_request={ "id": project_apply_id, "status": 1, "remark": "remark" }) # 获取项目列表 res = project_api.projects_get(page=1) audit_project_id = '' for item in res.items: assert item.project_name == project_name assert item.full_name == full_name assert item.short_name == short_name audit_project_id = item.project_id # 发送新闻资讯 news_api = NewManagementApi() set_login_status(news_api, token) payload1 = { 'title': '新闻资讯' + str(random.randint(1000, 9999)), 'link': 'www.baidu.com', 'source': '百度', 'project_id': audit_project_id } req = PostNewsRequest(**payload1) news_api.news_post(body=req) # 获取项目资讯列表 staff_am_api = AnnouncementManagementApi() set_login_status(staff_am_api, token) news_id = '' staff_am_api = AnnouncementManagementApi() set_login_status(staff_am_api, token) res = staff_am_api.news_project_id_get(project_id=audit_project_id) assert res.meta.total_count == 1 for item in res.items: assert item.title == payload1['title'] assert item.source == payload1['source'] assert item.status is True assert item.url news_id = item.id # 修改项目资讯状态 staff_am_api.news_id_status_put(id=news_id, status=False) # 获取项目列表资讯 res = staff_am_api.news_project_id_get(project_id=audit_project_id) assert res.meta.total_count == 1 for item in res.items: assert item.title == payload1['title'] assert item.source == payload1['source'] assert item.status is False
def test_staff_venture_case1(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) # 申请项目 project_name = get_random_name(2, 16) short_name = "WE" + str(random.randint(1000, 9999)) full_name = get_random_name(2, 16) project_api = ProjectApi() set_login_status(project_api, token) pay = copy.deepcopy(dict(payload)) pay.update({ 'project_name': project_name, 'short_name': short_name, 'full_name': full_name }) req = ApplicationRequest(**pay) res = project_api.applications_post(body=req) project_apply_id = res.id # 创建保健方账号 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) # 项目方获取保健列表 venture_api = SMApi() set_login_status(venture_api, token) res = venture_api.sponsors_get(page=1, name=sponsor.get("name")) item = res.items.pop() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 保健方登 # 保健项目 sponsor_api = SponsorsProjectApi() get_sponsor_token(account=sponsor.get("account"), password=sponsor.get("password"), email=sponsor.get("email"), api_list=[sponsor_api]) sponsor_api.projects_sponsor_put(put_project_sponsor_request={ "id": project_apply_id, "status": 1, "remark": "remark" }) # 币种配置列表 asset_api = AssetManagementApi() set_login_status(asset_api, staff_token) res = asset_api.asset_mgmt_coins_get(page=1, coin_name=short_name) coin_id = '' assert res.meta.total_count == 1 for item in res.items: assert item.coin_name == short_name coin_id = item.id # 初始化币种配置 payload1 = { "usdtPrice": "1", "rcTimes": 0, "wcTimes": 0, "withdrawRate": "1", "minWithdrawFee": "1", "minWithdraw": "1", "maxWithdraw": "1", "dayWithdrawTotal": "1", "minRecharge": "1", "addressTagSwitch": True, "addressType": "1", "addressUrl": "1", "txidUrl": "1" } asset_api.asset_mgmt_coins_id_init_put(id=coin_id, body=payload1) # 后台查询项目方用户列表 staff_venture_api = VentureManagementApi() set_login_status(staff_venture_api, token) res = staff_venture_api.accounts_ventures_get(email=email) assert res.meta.total_count == 1 uid = '' for item in res.items: assert item.email == email assert item.venture_id uid = item.uid # 获取项目方用户信息 res = staff_venture_api.accounts_ventures_id_get(id=uid) assert res.email == email assert res.account_id assert res.venture_id
def create_venture(): faker = Faker() manager = PlatformManager("venture") user = random_user() manager.register(email=user.get("email"), password=user.get("password"), promotion_code=None, verification_code="666666", nationality_code=user.get("country_abbreviation")) token = manager.login(account=user.get("email"), password=user.get("password")) # 个人实名认证 individual_verify(platform="venture", id_number=get_random_id_number(), token=token) # 申请项目 project_api = ProjectApi() set_login_status(project_api, token) project_name = get_random_name(2, 16) full_name = get_random_name(2, 12) short_name = get_random_name(2, 6) # project_name = "USDT" # short_name = "USDT" res = project_api.applications_post( body={ "projectName": project_name, "description": "{}-project-description".format(project_name), "officialWebsite": "www.{}.com".format(project_name), "whitePaperKey": "{}-whitePaper".format(project_name), "areaCode": "+86", "projectPosterKey": faker.uri_page(), # "projectPosterUrl": faker.url(), "cellphone": "123456789", "telephone": "12345678910", "email": faker.email(), "fullName": "{}的全部名".format(full_name), "shortName": short_name, "issuePrice": "2.24545", "issuedVolume": "1000000", "circulationVolume": "1000000", "issuedDate": "2018-08-08", "coinLogoKey": faker.uri_page(), # "coinLogoUrl": faker.url(), "blockchainType": "public_chain", "dataLink": "{}-data-link".format(project_name), "blockBrowser": "{}-block-Browser".format(project_name) }) project_apply_id = res.id # 创建保健方账号 staff_api = SponsorsManagermentApi() staff_token = get_admin_token() set_login_status(staff_api, staff_token) sponsor = { "account": get_random_name(8, 20), "password": faker.password(), "name": get_random_name(2, 20), "email": faker.email(), "phone": faker.phone_number() } staff_api.staff_sponsors_post(post_sponsor=sponsor) # 项目方获取保健列表 venture_api = SMApi() set_login_status(venture_api, token) res = venture_api.sponsors_get(page=1, name=sponsor.get("name")) item = res.items.pop() sponsor_id = item.id # 项目方设置保健方 project_api.applications_id_set_sponsor_put( id=project_apply_id, sponsor_request={"sponsorId": sponsor_id}) # 保健方登录 # 保健项目 sponsor_api = SponsorsProjectApi() get_sponsor_token(account=sponsor.get("account"), password=sponsor.get("password"), email=sponsor.get("email"), api_list=[sponsor_api]) sponsor_api.projects_sponsor_put(put_project_sponsor_request={ "id": project_apply_id, "status": 1, "remark": "remark" }) # 获取币种列表 asset_api = AssetManagementApi() set_login_status(asset_api, staff_token) res = asset_api.asset_mgmt_coins_get(coin_name=short_name) coin = res.items.pop() coin_id = coin.id # 项目初始化 # staff_project_api = StaffProjectApi() # set_login_status(staff_project_api, staff_token) # staff_project_api.projects_coin_id_init_put(coin_id=coin_id, # body={ # "initFee": 111 # }) rc_confirmed_times = 2 wc_confirmed_times = 2 asset_api.asset_mgmt_coins_id_init_put(id=coin_id, body={ "usdtPrice": "1", "rcTimes": rc_confirmed_times, "wcTimes": wc_confirmed_times, "withdrawRate": "0.003", "minWithdrawFee": "0.1", "minWithdraw": "20", "maxWithdraw": "1000", "dayWithdrawTotal": "30000", "minRecharge": "0.1", "addressTagSwitch": True, "addressType": short_name, "addressUrl": "addressUrl", "txidUrl": "fdfsfdstxidUrl" }) # # 修改币种配置 # asset_api.asset_mgmt_coins_id_put( # id=coin.id, body={ # "rcTimes": 2, # "wcTimes": 2, # "withdrawRate": "0.003", # "minWithdrawFee": "0.1", # "minWithdraw": "20", # "maxWithdraw": "1000", # "dayWithdrawTotal": "30000", # "minRecharge": "0.1", # "addressTagSwitch": True, # "addressType": short_name, # "addressUrl": "addressUrl", # "txidUrl": "fdfsfdstxidUrl" # }) register_wallet(short_name) return coin.id, coin.coin_id, short_name, rc_confirmed_times, wc_confirmed_times