Exemplo n.º 1
0
    def test_get(self):
        cache.set('foo', 'bar', 60)
        cache.set('moof', 'baz', 1)

        simple_cache = SimpleCache()
        self.assertEqual(simple_cache.get('foo'), 'bar')
        self.assertEqual(simple_cache.get('moof'), 'baz')
        self.assertEqual(simple_cache.get(''), None)
Exemplo n.º 2
0
 def test_get(self):
     cache.set('foo', 'bar', 60)
     cache.set('moof', 'baz', 1)
     
     simple_cache = SimpleCache()
     self.assertEqual(simple_cache.get('foo'), 'bar')
     self.assertEqual(simple_cache.get('moof'), 'baz')
     self.assertEqual(simple_cache.get(''), None)
Exemplo n.º 3
0
 def test_set(self):
     simple_cache = SimpleCache()
     simple_cache.set('foo', 'bar')
     simple_cache.set('moof', 'baz', timeout=1)
     
     # Use the underlying cache system to verify.
     self.assertEqual(cache.get('foo'), 'bar')
     self.assertEqual(cache.get('moof'), 'baz')
     
     # Check expiration.
     time.sleep(2)
     self.assertEqual(cache.get('moof'), None)
Exemplo n.º 4
0
    def test_set(self):
        simple_cache = SimpleCache()
        simple_cache.set('foo', 'bar')
        simple_cache.set('moof', 'baz', timeout=1)

        # Use the underlying cache system to verify.
        self.assertEqual(cache.get('foo'), 'bar')
        self.assertEqual(cache.get('moof'), 'baz')

        # Check expiration.
        time.sleep(2)
        self.assertEqual(cache.get('moof'), None)