Files
Kyle L. Jensen 2c7f0d65c8 Initial import.
2012-06-27 11:24:08 -04:00

23 lines
580 B
Python

import testify
import requests
from reqcache.models import ReqCache
class ReqCacheTestCase(testify.TestCase):
@testify.setup
def create_cache(self):
self.rcache = ReqCache("test", "memory")
@testify.teardown
def clear_cache(self):
self.rcache = None
def test_basic_caching(self):
r = requests.get('http://github.com', hooks=self.rcache.hooks)
self.assertFalse(getattr(r, "from_cache", False))
r = requests.get('http://github.com', hooks=self.rcache.hooks)
self.assertTrue(getattr(r, "from_cache", False))