def test_lock_unlock3(self): #设置权限为高级解锁人,去设置自己工程信息的leads的锁定 """设置权限->登录->锁定""" r = SetRoles().mega(user="******", job_title_id=10188, role_ids="[1,29,32,33,34,20]") self.assertEqual(10000, r.code) self.assertEqual(True, r.data.result) self.assertEqual('success', r.message) client = start_client() res = client.lock(id=87684) resjson = json.loads(res.text) self.assertEqual(-997, resjson["code"]) self.assertEqual('error', resjson["message"]) #普通解锁,解锁自己工程信息的leads r = SetRoles().mega(user="******", job_title_id=10188, role_ids="[1,26,32,33,34,20]") self.assertEqual(10000, r.code) self.assertEqual(True, r.data.result) self.assertEqual('success', r.message) client = start_client() resp = client.unlock(id=87684) respjson = json.loads(resp.text) self.assertEqual(-997, respjson["code"]) self.assertEqual('error', resjson["message"])
def test_sale_releads_leads_p1_henry(self): """设置权限->登录->获取leads->释放leads""" r = SetRoles().mega( "huimei.tao", job_title_id=D.get_leads_data_p1_service.job_title_id, role_ids=D.get_leads_data_p1_service.role_ids) self.assertEqual(r.code, 10000) login_client = Login(base_url=services.mega) resp = login_client.get_token(username=D.user_mega.username, password=D.user_mega.password) self.token = resp.data.session_id self.client = LeadsClient(base_url=services.mega, access_token=self.token) rg = self.client.get_leads( new_sales_id=D.get_leads_data_p1_service.new_sales_id, sub_firm_id=D.get_leads_data_p1_service.sub_firm_id, leads_type_id=D.get_leads_data_p1_service.leads_type_id) self.assertEqual(rg.code, 10000) self.assertEqual(rg.message, 'success') resp = login_client.get_token(username=D.user_mega.username_henry, password=D.user_mega.password) self.token = resp.data.session_id self.client = LeadsClient(base_url=services.mega, access_token=self.token) resp = self.client.release_leads( sub_firm_id=D.get_leads_data_p1_service.sub_firm_id, leads_type_id=D.get_leads_data_p1_service.leads_type_id, release_reason_id=D.get_leads_data_p1_service.release_reason_id, give_up_reason_id=D.get_leads_data_p1_service.give_up_reason_id, release_type_id=D.get_leads_data_p1.release_type_id) self.assertEqual(resp.code, 10000) self.assertEqual(resp.message, 'success')
def test_delay_leads_project_info(self): """延期leads-leads ID不存在""" SetRoles().mega(user="******", job_title_id=10005, role_ids=[1, 2, 3, 5, 13, 29, 11, 20, 31, 33]) resp = self.client.delay_leads(leads_id=1, extend_months=1) self.assertEqual(RecallsBiz.ERROE_CODE_NO_DATA, resp.code)
def test_sale_releads_leads_level2_sanmi(self): """设置权限->登录->获取leads->释放leads""" r = SetRoles().mega("huimei.tao", job_title_id=D.get_leads_data_p1.job_title_id, role_ids=D.get_leads_data_p1.role_ids) self.assertEqual(r.code, 10000) login_client = Login(base_url=services.mega) resp = login_client.get_token(username="******", password=D.user_mega.password) self.token = resp.data.session_id self.client = LeadsClient(base_url=services.mega, access_token=self.token) rg = self.client.get_leads( new_sales_id=D.get_leads_data_level2.new_sales_id, sub_firm_id=D.get_leads_data_level2.sub_firm_id, leads_type_id=10020) self.assertEqual(rg.code, 10000) self.assertEqual(rg.message, 'success') resp = login_client.get_token(username=D.user_mega.username_sanmi, password=D.user_mega.password) self.token = resp.data.session_id self.client = LeadsClient(base_url=services.mega, access_token=self.token) resp = self.client.release_leads( sub_firm_id=D.get_leads_data_level2.sub_firm_id, leads_type_id=10020, release_reason_id=D.get_leads_data_level2.release_reason_id, release_type_id=D.get_leads_data_p1.release_type_id) self.assertEqual(resp.code, 10000) self.assertTrue("success" in resp.message)
def test_account_detail(self): """企业试用账号-详情页""" SetRoles().mega("huimei.tao", job_title_id=10188, role_ids="[1,8,29,11,19,33,20]") resp = self.client.account_detail(a_id=807232) self.assertEqual(10000, resp.code) self.assertEqual(255309, resp.data.sub_firm_id)
def test_cce_support(self): """ 提交cce support task """ SetRoles().mega("huimei.tao", job_title_id=10188, role_ids="[5]") resp = self.client.cce_support_url(contact_id=97583, sub_firm_id=14621) self.assertEqual(resp.code, 10000) self.assertIsNotNone(resp.data.url)
def test_delay_leads_project_info_invalid(self): """延期leads_超出三次""" SetRoles().mega(user="******", job_title_id=10005, role_ids=[1, 2, 3, 5, 13, 29, 11, 20, 31, 33]) resp = self.client.delay_leads(leads_id=14705, extend_months=1) self.assertEqual(3999, resp.code) self.assertEqual(RecallsBiz.Delay_OverLimit, resp.message)
def test_get_account_detail(self): """获取企业正式账号详情""" SetRoles().mega(user="******", job_title_id=10188, role_ids="[1,29,19,33]") resp = self.client.subscribers_show(a_id=D.sub_firm_id_255309.a_id) self.assertEqual(10000, resp.code) self.assertEqual(D.sub_firm_id_255309.sub_firm_id, resp.data.sub_firm_id) self.assertGreaterEqual(len(resp.data.subscriptions), 1) self.assertEqual(D.sub_firm_id_255309.created_by_name, resp.data.created_by_name)
def test_lock_unlock999(self): #设置权限为特殊解锁人并锁定自己的工程信息leads """设置权限->登录->锁定""" r = SetRoles().mega(user="******", job_title_id=10188, role_ids="[1,30,32,33,34,20]") self.assertEqual(10000, r.code) self.assertEqual(True, r.data.result) self.assertEqual('success', r.message) client = start_client() client.lock(id=1359) rolelist = [26, 27, 28, 29] for role in rolelist: SetRoles().mega(user="******", job_title_id=10188, role_ids="[1,%s]" % role) client = start_client() resp = client.unlock(id=1359) res = json.loads(resp.text) self.assertEqual(10000, res["code"]) self.assertEqual('success', res["message"])
def test_get_leads(self): """ 详情页获取、分配leads :return: """ SetRoles().mega("huimei.tao",job_title_id=10188,role_ids="[1,8,29,11,19,33,20]") login_client = Login(base_url=services.mega) resp = login_client.get_token(username=D.user_mega.username, password=D.user_mega.password) self.token = resp.data.session_id self.client = LeadsClient(base_url=services.mega, access_token=self.token) resp = self.client.get_leads(new_sales_id=D.get_leads_data.new_sales_id,sub_firm_id=D.get_leads_data.sub_firm_id, leads_type_id=D.get_leads_data.leads_type_id) self.assertEqual(resp.code, 10000)
def test_lock_unlock(self): #无角色解锁 """设置权限->登录->解锁""" r = SetRoles().mega(user="******", job_title_id=10188, role_ids="[1]") self.assertEqual(10000, r.code) self.assertEqual(True, r.data.result) self.assertEqual('success', r.message) client = start_client() resp = client.unlock(id=87684) respjson = json.loads(resp.text) self.assertEqual(-997, respjson["code"]) self.assertEqual('error', respjson["message"])
def test_get_firms_info(self): """设置权限->创建公司->获取公司详情""" firm_names = '[{"name":"内蒙古小飞侠公司","remark":"1111","reason":"","repeated":"false"}]' SetRoles().mega(user="******", job_title_id=10188, role_ids="[1,8,29,35,36]") respfirms = self.client.create_sub_firms( firm_names=firm_names, home_country_id=D.create_sub_firms.home_country_id, country_id=D.create_sub_firms.country_id) self.assertEqual(10000, respfirms.code) self.assertEqual("内蒙古小飞侠公司(1111)", respfirms.data.firm_name) respfirmsinfo = self.client.sub_firms_detail(firm_id=respfirms.data.id) self.assertEqual(10000, respfirmsinfo.code) self.assertEqual("内蒙古小飞侠公司(1111)", respfirmsinfo.data.firm_name) self.assertEqual(respfirms.data.id, respfirmsinfo.data.id)
def test_create_sub_firms(self): """设置权限->创建公司->搜索是否创建成功""" firm_names = '[{"name":"内蒙古小飞侠公司","remark":"1111","reason":"","repeated":"false"}]' SetRoles().mega(user="******", job_title_id=10188, role_ids="[1,8,29,35,36]") respfirms = self.client.create_sub_firms( firm_names=firm_names, home_country_id=D.create_sub_firms.home_country_id, country_id=D.create_sub_firms.country_id) self.assertEqual(10000, respfirms.code) self.assertEqual("内蒙古小飞侠公司(1111)", respfirms.data.firm_name) respsearch = self.client.simple_search( search_name=respfirms.data.firm_name) self.assertEqual(10000, respsearch.code) self.assertEqual(1, respsearch.data.page) self.assertEqual(10, respsearch.data.per_page)
def test_grab4(self): """ leads获取 多人同时获取 :return: """ rolesres = SetRoles().mega( user="******", job_title_id=10188, role_ids= "[1,4,5,6,8,13,30,26,27,28,29,9,10,11,12,14,15,16,18,19,20,21,31,22,23,24,25,35,36,37,32,33,34]" ) self.assertEqual(rolesres.code, 10000) new_sales_ids = [39206, 440212] for new_sales_id in new_sales_ids: resp = self.client.grab(new_sales_id=new_sales_id, sub_firm_id=255309, leads_type_id=1) self.assertEqual(resp.code, 10000)
def test_ungrab(self): """ leads空置 设置权限->获取leads->空置leads :return: """ r = SetRoles().mega("huimei.tao", job_title_id=10188, role_ids="[1,19,29]") self.assertEqual(r.code, 10000) self.assertEqual(r.message, "success") resp = self.client.grab(new_sales_id=D.grab.new_sales_id1, sub_firm_id=D.grab.sub_firm_id1, leads_type_id=D.grab.leads_type_id1) self.assertEqual(resp.code, 10000) self.assertEqual(resp.message, "success") resp = self.client.ungrab(new_sales_id=D.grab.new_sales_id1, sub_firm_id=D.grab.sub_firm_id1, leads_type_id=D.grab.leads_type_id1) self.assertEqual(resp.code, 10000) self.assertEqual(resp.message, "success")
def test_grab(self): """ leads获取 多人同时获取 设置权限->登录allen->登录tony->同时获取 :return: """ rolesres=SetRoles().mega(user="******", job_title_id=10005, role_ids="[1,4,5,6,8,13,30,26,27,28,29,9,10,11,12,14,15,16,18,19,20,21,31,22,23,24,25,35,36,37,32,33,34]") self.assertEqual(rolesres.code,10000) self.assertEqual(rolesres.message,"success") login_client = Login(base_url=services.mega) respallen = login_client.get_token(username="******", password="******") resptony = login_client.get_token(username="******", password="******") self.allentoken = respallen.data.session_id self.allenclient = LeadsClient(base_url=services.mega, access_token=self.allentoken) self.tonytoken = resptony.data.session_id self.tonyclient = LeadsClient(base_url=services.mega, access_token=self.tonytoken) resp = self.tonyclient.grab(new_sales_id=39206,sub_firm_id=255309,leads_type_id=1) self.assertEqual(resp.code,10000) #跳过禁止不积极的时间 if resp.code !=3514: self.assertIn(resp.code,[10000,3515,3517]) resp1 = self.allenclient.grab(new_sales_id=440212,sub_firm_id=255309,leads_type_id=1) self.assertIn(resp1.code,[10000,3515,3517])
def test_create_sub_firms1(self): """创建公司""" SetRoles().mega(user="******",job_title_id=10188,role_ids="[1,8,29,35,36]") resp = self.client.create_sub_firms(firm_names='[{"name":"内蒙古小飞侠公司","remark":1,"reason":2}]',home_country_id=D.create_sub_firms.home_country_id1,country_id=D.create_sub_firms.country_id1) self.assertEqual(resp.code, 0)