Esempio 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'
Esempio 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'
Esempio 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'
Esempio 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']
Esempio n. 5
0
 def test_parse_mount_string_invalid(self):
     with pytest.raises(InvalidArgument):
         Mount.parse_mount_string("foo:bar:baz:rw")
Esempio 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
Esempio 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']
Esempio 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'
Esempio 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'
Esempio 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'
Esempio n. 11
0
 def test_parse_mount_string_invalid(self):
     with pytest.raises(InvalidArgument):
         Mount.parse_mount_string("foo:bar:baz:rw")
Esempio 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']
Esempio 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']
Esempio 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