Example #1
0
    def test_memory_cache_getAttributes(self):
        memory_cache = self._create_memory_cache()

        root_path = "/"
        root_stat = 54321
        self.assertEqual(None, memory_cache.getAttributes(root_path))
        memory_cache.cacheAttributes(root_path, root_stat)
        self.assertEqual(root_stat, memory_cache.getAttributes(root_path).stat)

        some_stat = 12345
        some_path = "/example/file"
        self.assertEqual(None, memory_cache.getAttributes(some_path))
        memory_cache.cacheAttributes(some_path, some_stat)
        self.assertEqual(some_stat, memory_cache.getAttributes(some_path).stat)
Example #2
0
    def test_memory_cache_getAttributes(self):
        memory_cache = self._create_memory_cache()

        root_path = "/"
        root_stat = 54321
        self.assertEqual(None, memory_cache.getAttributes(root_path))
        memory_cache.cacheAttributes(root_path, root_stat)
        self.assertEqual(root_stat, memory_cache.getAttributes(root_path).stat)

        some_stat = 12345
        some_path = "/example/file"
        self.assertEqual(None, memory_cache.getAttributes(some_path))
        memory_cache.cacheAttributes(some_path, some_stat)
        self.assertEqual(some_stat, memory_cache.getAttributes(some_path).stat)
Example #3
0
    def test_memory_cache_listDirectory(self):
        memory_cache = self._create_memory_cache()
        memory_cache.cacheAttributes('/', 1)
        memory_cache.cacheAttributes('/home', 2)
        memory_cache.cacheAttributes('/home/a', 3)
        memory_cache.cacheAttributes('/home/b', 4)

        memory_cache.markAsChildrenCached('/', True)
        self.assertEqual(['home'], memory_cache.listDirectory('/'))

        memory_cache.markAsChildrenCached('/home', True)
        self.assertEqual(['a', 'b'], memory_cache.listDirectory('/home'))
Example #4
0
    def test_memory_cache_listDirectory(self):
        memory_cache = self._create_memory_cache()
        memory_cache.cacheAttributes('/', 1)
        memory_cache.cacheAttributes('/home', 2)
        memory_cache.cacheAttributes('/home/a', 3)
        memory_cache.cacheAttributes('/home/b', 4)

        memory_cache.markAsChildrenCached('/', True)
        self.assertEqual(['home'], memory_cache.listDirectory('/'))

        memory_cache.markAsChildrenCached('/home', True)
        self.assertEqual(['a', 'b'], memory_cache.listDirectory('/home'))