def exam_login(self, **kwargs): self.req_method = 'GET' self.req_url = '/gzlqb/scienceart/user/login' self.req_body = kwargs result = self.x_request() assert_util.result_check(result) auth_util.set_token('bbc', 'exam_token', result.rsp.cookies["exam_token"]) return result
def phone_login(self, phone): self.req_method = 'GET' self.req_url = '/core/user/phoneLogin' self.req_body = {"phone": phone, "code": 123456} self.req_cookies = { 'JSESSIONID': auth_util.get_cookie('web'), } result = self.x_request() assert_util.result_check(result) # auth_util.set_cookie('web', result.rsp.cookies["JSESSIONID"]) auth_util.set_token('web', 'gz_token', result.rsp.cookies["token"]) return result
def req_post_with_data(self, **kwargs): self.req_method = 'POST' self.req_url = '/core/account/submit' self.req_body = kwargs self.req_cookies = { 'JSESSIONID': auth_util.get_token('crm', 'jsessionid'), 'exam_token': auth_util.get_token('bbc', 'exam_token'), } result = self.request( method=self.req_method, url=self.req_url, headers=self.req_headers, cookies=self.req_cookies, data=self.req_body ) auth_util.set_token('bbc', 'exam_token', result.rsp.cookies["exam_token"]) assert_util.result_check(result) return result
def login(self, phone): self.req_method = 'GET' self.req_url = '/core/user/login' self.req_body = { "phone": phone, "userPassword": '******', # common.calc_pwd(phone), # 't': common.get_timestamp(), # 'countryCode': '86' } self.req_cookies = { 'JSESSIONID': auth_util.get_cookie('web'), } result = self.x_request() assert_util.result_check(result) auth_util.set_token('web', 'gz_token', result.rsp.cookies["token"]) return result
def crm_login_with(self, account_name): self.req_method = 'get' self.req_url = '/core/account/login' self.req_body = { "accountName": account_name, "accountPassword": "******", "captcha": 'qwe123EWQ#@!' } result = self.x_request() assert_util.result_check(result) core_jsessionid = result.rsp.cookies["JSESSIONID"] api_account_token = result.rsp.cookies["api_account_token"] # auth_util.set_cookie('crm', core_jsessionid) auth_util.set_token('crm', 'jsessionid', core_jsessionid) auth_util.set_token('crm', 'api_account_token', api_account_token) logger.debug(core_jsessionid) return result
def login(self, **kwargs): self.req_method = 'POST' self.req_url = '/mxcaccount/account/login' self.req_body = { 'accountName': '*****@*****.**', 'accountPassword': '******', 'captcha': '7d5c' } self.req_headers = {'mxc-token': None} self.req_cookies = { 'SESSION': auth_util.get_token('mxc', 'SESSION'), } result = self.request(method=self.req_method, url=self.req_url, headers=self.req_headers, cookies=self.req_cookies, data=self.req_body) assert_util.result_check(result) auth_util.set_token('mxc', 'mxc-token', result.rsp.headers['mxc-token']) return result