コード例 #1
0
 def test_open_non_existing_resource(self):
     folder = api.Folder(self.store, "foo")
     try:
         folder.open_resource("confml/test.confml", "r")
     except Exception:
         pass
     self.assertEquals(folder.storage.curpath, '')
コード例 #2
0
 def test_open_resource(self):
     folder = api.Folder(self.store, "foo")
     res = folder.open_resource("confml/test.confml", "w")
     res.write("foo.conf")
     res.close()
     self.assertEquals(folder.list_resources("", recurse=True),
                       ["confml/test.confml"])
     self.assertEquals(self.store.list_resources("", recurse=True),
                       ["foo/confml/test.confml"])
コード例 #3
0
 def test_open_resource(self):
     store = api.Storage.open(storage_path, "w")
     layer = api.Folder(store, "foo")
     self.assertTrue(layer)
     res = layer.open_resource("confml/test.confml", "w")
     res.write("foo.conf")
     res.close()
     self.assertEquals(layer.list_resources("", recurse=True),
                       ["confml/test.confml"])
     self.assertEquals(store.list_resources("", recurse=True),
                       ["foo/confml/test.confml"])
コード例 #4
0
 def test_create_two_layers_and_open_resource(self):
     foo_folder = api.Folder(self.store, "foo")
     bar_folder = api.Folder(self.store, "bar")
     res = foo_folder.open_resource("confml/test.confml", "w")
     res.write("foo.conf")
     res.close()
     res = foo_folder.open_resource("root.confml", "w")
     res.close()
     res = bar_folder.open_resource("confml/root.confml", "w")
     res.write("foo.conf")
     res.close()
     self.assertEquals(foo_folder.list_resources("", recurse=True),
                       ['root.confml', 'confml/test.confml'])
     self.assertEquals(self.store.list_resources("", recurse=True), [
         'bar/confml/root.confml', 'foo/root.confml',
         'foo/confml/test.confml'
     ])
     foo_folder.delete_resource("confml/test.confml")
     self.assertEquals(foo_folder.list_resources("", recurse=True),
                       ["root.confml"])
     self.assertEquals(self.store.list_resources("", recurse=True),
                       ["bar/confml/root.confml", "foo/root.confml"])
コード例 #5
0
 def test_get_path(self):
     folder = api.Folder(self.store, "foo")
     self.assertEquals(folder.get_current_path(), "foo")
コード例 #6
0
 def test_create_folder(self):
     folder = api.Folder(self.store, "subfolder")
     self.assertTrue(folder)
コード例 #7
0
 def test_get_path(self):
     store = api.Storage.open(storage_path, "w")
     layer = api.Folder(store, "foo")
     self.assertTrue(layer)
     self.assertEquals(layer.get_current_path(), "foo")
コード例 #8
0
 def test_create_folder(self):
     store = api.Storage.open(storage_path, "w")
     layer = api.Folder(store, "foo")
     self.assertTrue(layer)