Example #1
0
    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
Example #2
0
 def list(self, id):
     resp = requests.get(self.list_url,
                         params={
                             "access_token": WeWork.get_token(),
                             "id": id
                         }).json()
     return resp
Example #3
0
 def delete(self, id):
     r = requests.get(self.delete_url,
                      params={
                          "access_token": WeWork.get_token(),
                          "id": id
                      }).json()
     self.verbose(r)
     return r
Example #4
0
 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
Example #5
0
 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
Example #6
0
 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
Example #7
0
 def setup_class(cls):
     cls.token = WeWork.get_token()
Example #8
0
 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
Example #9
0
 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
Example #10
0
 def test_get_tokne(self):
     wework = WeWork()
     r = wework.get_token('oKPwlYZ2bMunvnI4q6ZDr94YYZc_a4OxH2KM3oEh82k')
Example #11
0
 def setup_class(cls):
     cls.membertools = MemberTools()
     # 传入secrect key,返回对应的token值
     cls.token = WeWork.get_token(cls.membertools.secret)