コード例 #1
0
 def test_remove_from_cache(self):
     cache_key = 1
     zenpy_object = self.cache_item(id=cache_key)
     self.assertIs(query_cache(get_object_type(zenpy_object), cache_key),
                   zenpy_object)
     delete_from_cache(zenpy_object)
     self.assertIs(query_cache(get_object_type(zenpy_object), cache_key),
                   None)
コード例 #2
0
ファイル: request.py プロジェクト: quintoandar/zenpy
 def delete(self, api_objects, *args, **kwargs):
     self.check_type(api_objects)
     if isinstance(api_objects, collections.Iterable):
         kwargs['destroy_ids'] = [i.id for i in api_objects]
     else:
         kwargs['id'] = api_objects.id
     payload = self.build_payload(api_objects)
     url = self.api._build_url(self.api.endpoint(*args, **kwargs))
     response = self.api._delete(url, payload=payload)
     delete_from_cache(api_objects)
     return response
コード例 #3
0
 def delete(self, tickets, *args, **kwargs):
     self.check_type(tickets)
     endpoint_kwargs = dict()
     if isinstance(tickets, collections.Iterable):
         endpoint_kwargs['destroy_ids'] = [i.id for i in tickets]
     else:
         endpoint_kwargs['id'] = tickets.id
     payload = self.build_payload(tickets)
     url = self.api._build_url(self.api.endpoint(**endpoint_kwargs))
     response = self.api._delete(url, payload=payload)
     delete_from_cache(tickets)
     return response
コード例 #4
0
ファイル: request.py プロジェクト: Aloomaio/zenpy
 def delete(self, tickets, *args, **kwargs):
     self.check_type(tickets)
     endpoint_kwargs = dict()
     if isinstance(tickets, collections.Iterable):
         endpoint_kwargs['destroy_ids'] = [i.id for i in tickets]
     else:
         endpoint_kwargs['id'] = tickets.id
     payload = self.build_payload(tickets)
     url = self.api._build_url(self.api.endpoint(**endpoint_kwargs))
     response = self.api._delete(url, payload=payload)
     delete_from_cache(tickets)
     return response
コード例 #5
0
ファイル: test_cache.py プロジェクト: Aloomaio/zenpy
 def test_remove_from_cache(self):
     cache_key = 1
     zenpy_object = self.cache_item(id=cache_key)
     self.assertIs(query_cache(get_object_type(zenpy_object), cache_key), zenpy_object)
     delete_from_cache(zenpy_object)
     self.assertIs(query_cache(get_object_type(zenpy_object), cache_key), None)