コード例 #1
0
ファイル: test_cache.py プロジェクト: sassyn/grafyaml
 def test_cache_has_changed(self):
     storage = cache.Cache(self.config.get("cache", "cachedir"))
     res = storage.has_changed("hello-world", self.dashboard["hello-world"])
     self.assertTrue(res)
     storage.set("hello-world", self.dashboard["hello-world"])
     res = storage.has_changed("hello-world", self.dashboard["hello-world"])
     self.assertFalse(res)
コード例 #2
0
ファイル: test_cache.py プロジェクト: pombredanne/grafyaml
 def test_cache_has_changed(self):
     storage = cache.Cache(self.config.get('cache', 'cachedir'))
     res = storage.has_changed('hello-world', self.dashboard['hello-world'])
     self.assertTrue(res)
     storage.set('hello-world', self.dashboard['hello-world'])
     res = storage.has_changed('hello-world', self.dashboard['hello-world'])
     self.assertFalse(res)
コード例 #3
0
ファイル: test_cache.py プロジェクト: pombredanne/grafyaml
 def test_cache_disabled_has_changed(self):
     storage = cache.Cache(self.config.get('cache', 'cachedir'), False)
     res = storage.has_changed('hello-world', self.dashboard['hello-world'])
     self.assertTrue(res)
     # Set a second time and confirm cache has_changed is True.
     storage.set('hello-world', self.dashboard['hello-world'])
     res = storage.has_changed('hello-world', self.dashboard['hello-world'])
     self.assertTrue(res)
コード例 #4
0
ファイル: test_cache.py プロジェクト: sassyn/grafyaml
 def test_cache_disabled_has_changed(self):
     storage = cache.Cache(self.config.get("cache", "cachedir"), False)
     res = storage.has_changed("hello-world", self.dashboard["hello-world"])
     self.assertTrue(res)
     # Set a second time and confirm cache has_changed is True.
     storage.set("hello-world", self.dashboard["hello-world"])
     res = storage.has_changed("hello-world", self.dashboard["hello-world"])
     self.assertTrue(res)
コード例 #5
0
ファイル: test_cache.py プロジェクト: sassyn/grafyaml
    def test_cache_set_multiple(self):
        storage = cache.Cache(self.config.get("cache", "cachedir"))
        storage.set("hello-world", self.dashboard["hello-world"])
        self.assertEqual(storage.get("hello-world"), self.dashboard["hello-world"])
        dashboard = {"foobar": "14758f1afd44c09b7992073ccf00b43d"}
        dashboard["hello-world"] = self.dashboard["hello-world"]

        storage.set("foobar", dashboard["foobar"])
        self.assertEqual(storage.get("foobar"), dashboard["foobar"])
        # Make sure hello-world is still valid.
        self.assertEqual(storage.get("hello-world"), self.dashboard["hello-world"])
コード例 #6
0
ファイル: test_cache.py プロジェクト: pombredanne/grafyaml
    def test_cache_set_multiple(self):
        storage = cache.Cache(self.config.get('cache', 'cachedir'))
        storage.set('hello-world', self.dashboard['hello-world'])
        self.assertEqual(storage.get('hello-world'),
                         self.dashboard['hello-world'])
        dashboard = {'foobar': '14758f1afd44c09b7992073ccf00b43d'}
        dashboard['hello-world'] = self.dashboard['hello-world']

        storage.set('foobar', dashboard['foobar'])
        self.assertEqual(storage.get('foobar'), dashboard['foobar'])
        # Make sure hello-world is still valid.
        self.assertEqual(storage.get('hello-world'),
                         self.dashboard['hello-world'])
コード例 #7
0
ファイル: test_cache.py プロジェクト: pombredanne/grafyaml
 def test_cache_disabled_set_single(self):
     storage = cache.Cache(self.config.get('cache', 'cachedir'), False)
     storage.set('hello-world', self.dashboard['hello-world'])
     # Make sure cache is empty
     self.assertEqual(storage.get('hello-world'), None)
コード例 #8
0
ファイル: test_cache.py プロジェクト: pombredanne/grafyaml
 def test_cache_set_single(self):
     storage = cache.Cache(self.config.get('cache', 'cachedir'))
     storage.set('hello-world', self.dashboard['hello-world'])
     self.assertEqual(storage.get('hello-world'),
                      self.dashboard['hello-world'])
コード例 #9
0
ファイル: test_cache.py プロジェクト: pombredanne/grafyaml
 def test_cache_disabled_get_empty(self):
     storage = cache.Cache(self.config.get('cache', 'cachedir'), False)
     self.assertEqual(storage.get('empty'), None)
コード例 #10
0
ファイル: test_cache.py プロジェクト: sassyn/grafyaml
 def test_cache_disabled_set_single(self):
     storage = cache.Cache(self.config.get("cache", "cachedir"), False)
     storage.set("hello-world", self.dashboard["hello-world"])
     # Make sure cache is empty
     self.assertEqual(storage.get("hello-world"), None)
コード例 #11
0
ファイル: test_cache.py プロジェクト: sassyn/grafyaml
 def test_cache_set_single(self):
     storage = cache.Cache(self.config.get("cache", "cachedir"))
     storage.set("hello-world", self.dashboard["hello-world"])
     self.assertEqual(storage.get("hello-world"), self.dashboard["hello-world"])
コード例 #12
0
ファイル: test_cache.py プロジェクト: sassyn/grafyaml
 def test_cache_disabled_get_empty(self):
     storage = cache.Cache(self.config.get("cache", "cachedir"), False)
     self.assertEqual(storage.get("empty"), None)