def path_volume_add_del_test(tmpdir): v = VolumeManager() assert v.setup() assert v.get_all_names() == [] my_path = str(tmpdir.mkdir("bla")) no_path = str(tmpdir.join("hugo")) # ok vol = v.add_volume("My:" + my_path) assert vol assert v.get_all_names() == ["My"] assert v.is_volume("MY") assert vol.is_setup assert vol.get_path() == my_path assert v.add_volume("foo:" + my_path) assert v.get_all_names() == ["My", "foo"] # duplicate path mapping assert not v.add_volume("foo:" + my_path) # duplicate path name assert not v.add_volume("my:" + no_path) # invalid path assert not v.add_volume("foo:" + no_path) # ok assert v.del_volume("my") assert not vol.is_setup assert v.get_all_names() == ["foo"] # invalid name assert not v.del_volume("baz") # shutdown v.shutdown()
def path_volume_cfg_test(tmpdir): my_path = str(tmpdir.mkdir("bla")) v = VolumeManager() cfg = ConfigDict({"volumes": ["my:" + my_path]}) assert v.parse_config(cfg) assert v.get_all_names() == ["my"] assert v.is_volume("MY")
def path_volume_cfg_test(tmpdir): my_path = str(tmpdir.mkdir("bla")) v = VolumeManager() cfg = ConfigDict({'volumes': ConfigDict({'my': my_path})}) assert v.parse_config(cfg) assert v.get_all_names() == ['my'] assert v.is_volume('MY')
def path_volume_add_del_test(tmpdir): v = VolumeManager() assert v.setup() assert v.get_all_names() == [] my_path = str(tmpdir.mkdir("bla")) no_path = str(tmpdir.join("hugo")) # ok vol = v.add_volume("My:" + my_path) assert vol assert v.get_all_names() == ['My'] assert v.is_volume('MY') assert vol.is_setup assert vol.get_path() == my_path assert v.add_volume("foo:" + my_path) assert v.get_all_names() == ['My', 'foo'] # duplicate path mapping assert not v.add_volume("foo:" + my_path) # duplicate path name assert not v.add_volume("my:" + no_path) # invalid path assert not v.add_volume("foo:" + no_path) # ok assert v.del_volume("my") assert not vol.is_setup assert v.get_all_names() == ['foo'] # invalid name assert not v.del_volume("baz") # shutdown v.shutdown()
def path_volume_cfg_test(tmpdir): my_path = str(tmpdir.mkdir("bla")) v = VolumeManager() cfg = ConfigDict({ 'volumes': [ 'my:' + my_path ] }) assert v.parse_config(cfg) assert v.get_all_names() == ['my'] assert v.is_volume('MY')
def path_volume_add_del_test(tmpdir): v = VolumeManager() assert v.get_all_names() == [] my_path = str(tmpdir.mkdir("bla")) no_path = str(tmpdir.join("hugo")) # ok assert v.add_volume("My", my_path) assert v.get_all_names() == ['My'] assert v.is_volume('MY') assert v.get_volume_sys_path('MY') == my_path # duplicate path mapping assert not v.add_volume("foo", my_path) # duplicate path name assert not v.add_volume("my", no_path) # invalid path assert not v.add_volume("foo", no_path) # ok assert v.del_volume("my") # invalid name assert not v.del_volume("baz")