def testEnd_CacheFileAlreadyOpen(self, data, endpoint, resource_id):
     cache_db = shelve.open(cache.API_CACHE)
     self.assertIsNone(cache.save(data, endpoint, resource_id))
     cache_db.close()
 def testArgs(self, data, endpoint, resource_id):
     assume(data != dict())
     cache.save(data, endpoint, resource_id)
     self.assertEqual(data, cache.load(endpoint, resource_id))
 def testArg_subresource_Text(self, data, endpoint, resource_id, subresource):
     self.assertIsNone(cache.save(data, endpoint, resource_id, subresource))
 def testEnv_CacheFileNotFound(self, data, endpoint, resource_id):
     assume(data != dict())
     os.remove(cache.API_CACHE)
     self.assertIsNone(cache.save(data, endpoint, resource_id))
 def testArg_resource_id_Text(self, data, endpoint, resource_id):
     assume(data != dict())
     with self.assertRaises(ValueError):
         cache.save(data, endpoint, resource_id)
 def testArg_data_Text(self, data, endpoint, resource_id):
     with self.assertRaises(ValueError):
         cache.save(data, endpoint, resource_id)
 def testArgs(self, data, endpoint, resource_id):
     self.assertIsNone(cache.save(data, endpoint, resource_id))
 def testArg_subresource_Text(self, data, endpoint, resource_id, subresource):
     assume(data != dict())
     cache.save(data, endpoint, resource_id, subresource)
     self.assertEqual(data, cache.load(endpoint, resource_id, subresource))
Exemple #9
0
 def testArgs_GettingCachedData(self, data, endpoint, resource_id):
     assume(data != dict())
     # save some data to the cache
     save(data, endpoint, resource_id)
     self.assertEqual(data, api.get_data(endpoint, resource_id))