def test_get_token(self): wework = WeWork() token = wework.get_token() assert token != None token = wework.get_token() assert token != None token = wework.get_token() assert token != None
def list(self, id): resp = requests.get(self.list_url, params={ "access_token": WeWork.get_token(), "id": id }).json() return resp
def delete(self, id): r = requests.get(self.delete_url, params={ "access_token": WeWork.get_token(), "id": id }).json() self.verbose(r) return r
def create(self, name, name_en, parentid, order): data = {"name": name, "name_en": name_en, "parentid": parentid, "order": order,"access_token": WeWork.get_token()} params = {"access_token": WeWork.get_token()} # 上传中有中文,需要设置UTF-8编码 headers = {'content-type': 'application/json; charset=utf-8'} self.do_request.add_headers(headers) self.json_data = self.do_request.send(self.create_url, method="post", data=data, params=params).json() self.verbose(self.json_data) return self.json_data
def creat(self, name, parentid, order): data = {"name": name, "parentid": parentid, "order": order, "id": None} r = requests.post(self.create_url, json=data, params={ "access_token": WeWork.get_token() }).json() self.verbose(r) return r
def creat(self, name, parentid, order): r = requests.post(self.creat_url, params={ "access_token": WeWork.get_token() }, json={ "name": name, "parentid": parentid, "order": order, "id": "" }).json() return r
def setup_class(cls): cls.token = WeWork.get_token()
def delete(self,id): params = {"access_token": WeWork.get_token(), "id": id} self.json_data = self.do_request.send(self.delete_url, method="get", params=params).json() return self.json_data
def list(self,id): params = {'access_token': WeWork.get_token(), 'id': id} self.json_data = self.do_request.send(self.list_url, method="get", params=params).json() self.verbose(self.json_data) return self.json_data
def test_get_tokne(self): wework = WeWork() r = wework.get_token('oKPwlYZ2bMunvnI4q6ZDr94YYZc_a4OxH2KM3oEh82k')
def setup_class(cls): cls.membertools = MemberTools() # 传入secrect key,返回对应的token值 cls.token = WeWork.get_token(cls.membertools.secret)