def test_cache_remove(self): cache = RequestCache() cache.put('http://ciao', 'value') self.assertEqual(cache.get('http://ciao'), 'value') cache.remove('http://ciao') self.assertRaises(RequestCacheMissingException, cache.get, 'http://ciao')
def test_cache_remove(self): cache = RequestCache() cache.put("http://ciao", "value") self.assertEqual(cache.get("http://ciao"), "value") cache.remove("http://ciao") self.assertRaises(RequestCacheMissingException, cache.get, "http://ciao")
def test_cache_valid_time(self, mock_time): mock_time.return_value = 0 cache = RequestCache(valid_time=100) cache.put('http://ciao', 'value') self.assertEqual(cache.get('http://ciao'), 'value') mock_time.return_value = 101 self.assertRaises(RequestCacheInvalidException, cache.get, 'http://ciao')
def test_cache_put_get(self): cache = RequestCache() cache.put('http://ciao', 'value') self.assertEqual(cache.get('http://ciao'), 'value') self.assertRaises( RequestCacheMissingException, cache.get, 'http://hola' )
def test_cache_valid_time(self, mock_time): mock_time.return_value = 0 cache = RequestCache(valid_time=100) cache.put('http://ciao', 'value') self.assertEqual(cache.get('http://ciao'), 'value') mock_time.return_value = 101 self.assertRaises( RequestCacheInvalidException, cache.get, 'http://ciao' )