def test_parse_mount_bind_windows(self): with mock.patch('docker.types.services.IS_WINDOWS_PLATFORM', True): mount = Mount.parse_mount_string('C:/foo/bar:/baz') assert mount['Source'] == "C:/foo/bar" assert mount['Target'] == "/baz" assert mount['Type'] == 'bind'
def test_parse_mount_named_volume(self): mount = Mount.parse_mount_string("foobar:/baz") assert mount['Source'] == 'foobar' assert mount['Target'] == '/baz' assert mount['Type'] == 'volume'
def test_parse_mount_bind(self): mount = Mount.parse_mount_string('/foo/bar:/baz') assert mount['Source'] == "/foo/bar" assert mount['Target'] == "/baz" assert mount['Type'] == 'bind'
def test_parse_mount_string_no_source(self): mount = Mount.parse_mount_string("foo/bar") assert mount['Source'] is None assert mount['Target'] == "foo/bar" assert not mount['ReadOnly']
def test_parse_mount_string_invalid(self): with pytest.raises(InvalidArgument): Mount.parse_mount_string("foo:bar:baz:rw")
def test_parse_mount_string_ro(self): mount = Mount.parse_mount_string("/foo/bar:/baz:ro") assert mount['Source'] == "/foo/bar" assert mount['Target'] == "/baz" assert mount['ReadOnly'] is True
def test_parse_mount_string_short_form(self): mount = Mount.parse_mount_string("/foo/bar:/baz") assert mount['Source'] == "/foo/bar" assert mount['Target'] == "/baz" assert not mount['ReadOnly']