equal
deleted
inserted
replaced
26 |
26 |
27 from soc.cache import base |
27 from soc.cache import base |
28 |
28 |
29 |
29 |
30 class CacheDecoratorTest(unittest.TestCase): |
30 class CacheDecoratorTest(unittest.TestCase): |
31 """Tests that the @cache decorator caches the result |
31 """Tests that the @cache decorator caches the result. |
32 """ |
32 """ |
33 |
33 |
34 def setUp(self): |
34 def setUp(self): |
35 self.called = 0 |
35 self.called = 0 |
36 decorator = base.getCacher(self.get, self.put) |
36 decorator = base.getCacher(self.get, self.put) |
51 |
51 |
52 def put(self, answer): |
52 def put(self, answer): |
53 memcache.add('answer_to_life', 42) |
53 memcache.add('answer_to_life', 42) |
54 |
54 |
55 def testMemcache(self): |
55 def testMemcache(self): |
56 """Santiy check to see if memcache is working |
56 """Sanity check to see if memcache is working. |
57 """ |
57 """ |
58 |
58 |
59 memcache.add('answer_to_life', 42) |
59 memcache.add('answer_to_life', 42) |
60 self.assertEqual(memcache.get('answer_to_life'), 42) |
60 self.assertEqual(memcache.get('answer_to_life'), 42) |
61 |
61 |
62 def testSidebarCaching(self): |
62 def testSidebarCaching(self): |
63 """Test that the caching decorator caches |
63 """Test that the caching decorator caches. |
64 """ |
64 """ |
65 |
65 |
66 self.failOnSecondCall() |
66 self.failOnSecondCall() |
67 self.failOnSecondCall() |
67 self.failOnSecondCall() |