~gz/pyjuju/0.5_default_instance_backport

« back to all changes in this revision

Viewing changes to juju/lib/tests/test_cache.py

  • Committer: Clint Byrum
  • Author(s): Kapil Thangavelu
  • Date: 2012-09-10 08:35:26 UTC
  • Revision ID: clint@ubuntu.com-20120910083526-04el6ce40gfeaise
OpenstackĀ providerĀ constraintsĀ support

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import time
 
2
 
 
3
from juju.lib.testing import TestCase
 
4
from juju.lib.cache import CachedValue
 
5
 
 
6
 
 
7
class CachedValueTest(TestCase):
 
8
 
 
9
    def test_cache_value(self):
 
10
 
 
11
        cache = CachedValue(10)
 
12
        cache.set(10)
 
13
        self.assertEqual(cache.get(), 10)
 
14
 
 
15
        n = time.time() + (3600 * 24)
 
16
        now = self.mocker.replace(time.time)
 
17
        now()
 
18
        self.mocker.result(n)
 
19
        self.mocker.replay()
 
20
        self.assertEqual(cache.get(), None)