def mega(self, user, job_title_id, role_ids): """ mega权限设置 :param user:用来设置权限的账号 :param job_title_id:职位id :param role_ids: 权限list :return: """ login_client = mega_login(base_url=services.mega) resp = login_client.get_token(username=user, password=D.user_mega.password) self.token = resp.data.session_id self.authclient = AuthClient(base_url=services.mega, access_token=self.token) res = self.authclient.right_roles(job_title_id=job_title_id, role_ids=role_ids) return res
def test_sale_releads_leads_level6_sanmi(self): """登录->获取leads->释放leads""" login_client = Login(base_url=services.mega) resp = login_client.get_token(username=D.user_mega.username, password=D.user_mega.password) self.assertEqual(resp.code, 10000) self.token = resp.data.session_id self.client = AuthClient(base_url=services.mega, access_token=self.token) resp = self.client.right_roles( job_title_id=D.get_leads_data_level6.job_title_id, role_ids=D.get_leads_data_level6.role_ids) if resp.code == 10000 and resp.message == 'success': self.client = LeadsClient(base_url=services.mega, access_token=self.token) rg = self.client.get_leads( new_sales_id=D.get_leads_data_level3.new_sales_id, sub_firm_id=D.get_leads_data_level3.sub_firm_id, leads_type_id=D.get_leads_data_level3.leads_type_id) 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_level6.sub_firm_id, leads_type_id=D.get_leads_data_level6.leads_type_id, release_reason_id=D.get_leads_data_level6.release_reason_id, give_up_reason_id=D.get_leads_data_level6.give_up_reason_id, release_type_id=D.get_leads_data_p1.release_type_id) self.assertEqual(resp.code, 10000) self.assertTrue("success" in resp.message)