mirror of https://github.com/docker/docker-py.git
Added unit test for named containers
This commit is contained in:
parent
78667c19a8
commit
8309ae7896
|
@ -203,6 +203,26 @@ class DockerClientTest(unittest.TestCase):
|
||||||
self.assertEqual(args[1]['headers'],
|
self.assertEqual(args[1]['headers'],
|
||||||
{'Content-Type': 'application/json'})
|
{'Content-Type': 'application/json'})
|
||||||
|
|
||||||
|
def test_create_named_container(self):
|
||||||
|
try:
|
||||||
|
self.client.create_container('busybox', 'true',
|
||||||
|
name='marisa-kirisame')
|
||||||
|
except Exception as e:
|
||||||
|
self.fail('Command should not raise exception: {0}'.format(e))
|
||||||
|
|
||||||
|
args = fake_request.call_args
|
||||||
|
self.assertEqual(args[0][0],
|
||||||
|
'unix://var/run/docker.sock/v1.4/containers/create')
|
||||||
|
self.assertEqual(json.loads(args[0][1]),
|
||||||
|
json.loads('''
|
||||||
|
{"Tty": false, "Image": "busybox", "Cmd": ["true"],
|
||||||
|
"AttachStdin": false, "Memory": 0,
|
||||||
|
"AttachStderr": true, "Privileged": false,
|
||||||
|
"AttachStdout": true, "OpenStdin": false}'''))
|
||||||
|
self.assertEqual(args[1]['headers'],
|
||||||
|
{'Content-Type': 'application/json'})
|
||||||
|
self.assertEqual(args[1]['params'], {'name': 'marisa-kirisame'})
|
||||||
|
|
||||||
def test_start_container(self):
|
def test_start_container(self):
|
||||||
try:
|
try:
|
||||||
self.client.start(fake_api.FAKE_CONTAINER_ID)
|
self.client.start(fake_api.FAKE_CONTAINER_ID)
|
||||||
|
|
Loading…
Reference in New Issue