Exemplo n.º 1
0
 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'
Exemplo n.º 2
0
 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'
Exemplo n.º 3
0
 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'
Exemplo n.º 4
0
 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']
Exemplo n.º 5
0
 def test_parse_mount_string_invalid(self):
     with pytest.raises(InvalidArgument):
         Mount.parse_mount_string("foo:bar:baz:rw")
Exemplo n.º 6
0
 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
Exemplo n.º 7
0
 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']
Exemplo n.º 8
0
 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'
Exemplo n.º 9
0
 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'
Exemplo n.º 10
0
 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'
Exemplo n.º 11
0
 def test_parse_mount_string_invalid(self):
     with pytest.raises(InvalidArgument):
         Mount.parse_mount_string("foo:bar:baz:rw")
Exemplo n.º 12
0
 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']
Exemplo n.º 13
0
 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']
Exemplo n.º 14
0
 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