Skip to content

Commit 28e27eb

Browse files
committed
Create test for volume as string
1 parent 10b11a3 commit 28e27eb

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,31 @@ def test_create_container_with_binds(self):
248248
self.assertEqual(args[1]['headers'],
249249
{'Content-Type': 'application/json'})
250250

251+
def test_create_container_with_volume_string(self):
252+
mount_dest = '/mnt'
253+
254+
try:
255+
self.client.create_container('busybox', ['ls', mount_dest],
256+
volumes=mount_dest)
257+
except Exception as e:
258+
self.fail('Command should not raise exception: {0}'.format(e))
259+
260+
args = fake_request.call_args
261+
self.assertEqual(args[0][0],
262+
url_prefix + 'containers/create')
263+
self.assertEqual(json.loads(args[1]['data']),
264+
json.loads('''
265+
{"Tty": false, "Image": "busybox",
266+
"Cmd": ["ls", "/mnt"], "AttachStdin": false,
267+
"Volumes": {"/mnt": {}}, "Memory": 0,
268+
"AttachStderr": true,
269+
"AttachStdout": true, "OpenStdin": false,
270+
"StdinOnce": false,
271+
"NetworkDisabled": false,
272+
"MemorySwap": 0}'''))
273+
self.assertEqual(args[1]['headers'],
274+
{'Content-Type': 'application/json'})
275+
251276
def test_create_container_with_ports(self):
252277
try:
253278
self.client.create_container('busybox', 'ls',

0 commit comments

Comments
 (0)