summaryrefslogtreecommitdiff
path: root/tests/test.py
diff options
context:
space:
mode:
authorPatrick Hensley <spaceboy@indirect.com>2014-10-17 16:06:14 -0400
committerPatrick Hensley <spaceboy@indirect.com>2014-10-17 16:06:14 -0400
commitf95c8c4dfcb6aa9cf8809ba52dd168dd63cf0a6f (patch)
tree937878a5e772239406a1bb41c616422e76d8e6f6 /tests/test.py
parentfce477243efb8e33bf1fba0a7e40f3256eae9963 (diff)
downloaddocker-py-f95c8c4dfcb6aa9cf8809ba52dd168dd63cf0a6f.tar.gz
Unit and integration tests for exec.
Diffstat (limited to 'tests/test.py')
-rw-r--r--tests/test.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test.py b/tests/test.py
index 984e350..e3a430c 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -1064,6 +1064,31 @@ class DockerClientTest(Cleanup, unittest.TestCase):
timeout=(docker.client.DEFAULT_TIMEOUT_SECONDS + timeout)
)
+ def test_execute_command(self):
+ try:
+ self.client.execute(fake_api.FAKE_CONTAINER_ID, ['ls', '-1'])
+ except Exception as e:
+ self.fail('Command should not raise exception: {0}'.format(e))
+
+ args = fake_request.call_args
+ self.assertEqual(args[0][0],
+ url_prefix + 'exec/3cc2351ab11b/start')
+
+ self.assertEqual(json.loads(args[1]['data']),
+ json.loads('''{
+ "Tty": false,
+ "AttachStderr": true,
+ "Container": "3cc2351ab11b",
+ "Cmd": ["ls", "-1"],
+ "AttachStdin": false,
+ "User": "",
+ "Detach": false,
+ "Privileged": false,
+ "AttachStdout": true}'''))
+
+ self.assertEqual(args[1]['headers'],
+ {'Content-Type': 'application/json'})
+
def test_kill_container(self):
try:
self.client.kill(fake_api.FAKE_CONTAINER_ID)