Exemplo n.º 1
0
    def testBasic(self):
        c = LocalSyncCache(id="test1")
        c["key1"] = "value1"
        self.assertEqual(c, {'key1': 'value1'})

        cache.set("test1", time.time())

        c.check_state()
        self.assertEqual(c, {})

        cache_information = LocalSyncCache.get_cache_information()
        self.assertEqual(len(cache_information), 1)
Exemplo n.º 2
0
    def testBasic(self):
        c = LocalSyncCache(id="test1")
        c["key1"] = "value1"
        assert_pformat_equal(c, {"key1": "value1"})

        cache.set("test1", time.time())

        c.check_state()
        assert_pformat_equal(c, {})

        cache_information = LocalSyncCache.get_cache_information()
        assert_pformat_equal(len(cache_information), 1)
Exemplo n.º 3
0
    def testBasic(self):
        c = LocalSyncCache(id="test1")
        c["key1"] = "value1"
        self.assertEqual(c, {'key1': 'value1'})

        cache.set("test1", time.time())

        c.check_state()
        self.assertEqual(c, {})

        cache_information = LocalSyncCache.get_cache_information()
        self.assertEqual(len(cache_information), 1)
Exemplo n.º 4
0
    def testBasic(self):
        c = LocalSyncCache(id="test1")
        c["key1"] = "value1"
        assert_pformat_equal(c, {"key1": "value1"})

        cache.set("test1", time.time())

        c.check_state()
        assert_pformat_equal(c, {})

        cache_information = LocalSyncCache.get_cache_information()
        assert_pformat_equal(len(cache_information), 1)
Exemplo n.º 5
0
    def testMulti(self):
        assert_pformat_equal(len(LocalSyncCache.CACHES), 0)
        c1 = LocalSyncCache(id="test1")
        assert_pformat_equal(len(LocalSyncCache.CACHES), 1)
        c2 = LocalSyncCache(id="test1", unique_ids=False)
        assert_pformat_equal(len(LocalSyncCache.CACHES), 2)
        c1["c1"] = "foo"
        c2["c2"] = "bar"
        assert_pformat_equal(c1, {"c1": "foo"})
        assert_pformat_equal(c2, {"c2": "bar"})

        c1.check_state()
        c2.check_state()

        assert_pformat_equal(c1, {"c1": "foo"})
        assert_pformat_equal(c2, {"c2": "bar"})

        c1.clear()
        assert_pformat_equal(c1, {})

        # In a "new request" all the same caches should be cleared
        c2.check_state()
        assert_pformat_equal(c2, {})

        cache_information = LocalSyncCache.get_cache_information()
        assert_pformat_equal(len(cache_information), 2)
Exemplo n.º 6
0
    def testMulti(self):
        self.assertEqual(len(LocalSyncCache.CACHES), 0)
        c1 = LocalSyncCache(id="test1")
        self.assertEqual(len(LocalSyncCache.CACHES), 1)
        c2 = LocalSyncCache(id="test1", unique_ids=False)
        self.assertEqual(len(LocalSyncCache.CACHES), 2)
        c1["c1"] = "foo"
        c2["c2"] = "bar"
        self.assertEqual(c1, {'c1': 'foo'})
        self.assertEqual(c2, {'c2': 'bar'})

        c1.check_state()
        c2.check_state()

        self.assertEqual(c1, {'c1': 'foo'})
        self.assertEqual(c2, {'c2': 'bar'})

        c1.clear()
        self.assertEqual(c1, {})

        # In a "new request" all the same caches should be cleared
        c2.check_state()
        self.assertEqual(c2, {})

        cache_information = LocalSyncCache.get_cache_information()
        self.assertEqual(len(cache_information), 2)
Exemplo n.º 7
0
    def testMulti(self):
        self.assertEqual(len(LocalSyncCache.CACHES), 0)
        c1 = LocalSyncCache(id="test1")
        self.assertEqual(len(LocalSyncCache.CACHES), 1)
        c2 = LocalSyncCache(id="test1", unique_ids=False)
        self.assertEqual(len(LocalSyncCache.CACHES), 2)
        c1["c1"] = "foo"
        c2["c2"] = "bar"
        self.assertEqual(c1, {'c1': 'foo'})
        self.assertEqual(c2, {'c2': 'bar'})

        c1.check_state()
        c2.check_state()

        self.assertEqual(c1, {'c1': 'foo'})
        self.assertEqual(c2, {'c2': 'bar'})

        c1.clear()
        self.assertEqual(c1, {})

        # In a "new request" all the same caches should be cleared
        c2.check_state()
        self.assertEqual(c2, {})

        cache_information = LocalSyncCache.get_cache_information()
        self.assertEqual(len(cache_information), 2)
Exemplo n.º 8
0
    def testMulti(self):
        assert_pformat_equal(len(LocalSyncCache.CACHES), 0)
        c1 = LocalSyncCache(id="test1")
        assert_pformat_equal(len(LocalSyncCache.CACHES), 1)
        c2 = LocalSyncCache(id="test1", unique_ids=False)
        assert_pformat_equal(len(LocalSyncCache.CACHES), 2)
        c1["c1"] = "foo"
        c2["c2"] = "bar"
        assert_pformat_equal(c1, {"c1": "foo"})
        assert_pformat_equal(c2, {"c2": "bar"})

        c1.check_state()
        c2.check_state()

        assert_pformat_equal(c1, {"c1": "foo"})
        assert_pformat_equal(c2, {"c2": "bar"})

        c1.clear()
        assert_pformat_equal(c1, {})

        # In a "new request" all the same caches should be cleared
        c2.check_state()
        assert_pformat_equal(c2, {})

        cache_information = LocalSyncCache.get_cache_information()
        assert_pformat_equal(len(cache_information), 2)