diff options
author | Joffrey F <joffrey@docker.com> | 2015-08-26 17:02:55 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2015-08-26 17:02:55 -0700 |
commit | 63df0b9ab33408f14beaae5e2850765cad2e437a (patch) | |
tree | 138523af74aa056674c43f010d06cd5f5c345eca /tests | |
parent | 0282e120ea3631f9fae53c3585095b8212122264 (diff) | |
parent | db1a93fd27a7627300c1fd54040d2f727ada78a4 (diff) | |
download | docker-py-63df0b9ab33408f14beaae5e2850765cad2e437a.tar.gz |
Merge branch 'master' of github.com:docker/docker-py
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration_test.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/integration_test.py b/tests/integration_test.py index 2de4a7f..6ba9c19 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -896,6 +896,40 @@ class TestExecuteCommandString(BaseTestCase): @unittest.skipIf(not EXEC_DRIVER_IS_NATIVE, 'Exec driver not native') +class TestExecuteCommandStringAsUser(BaseTestCase): + def runTest(self): + container = self.client.create_container('busybox', 'cat', + detach=True, stdin_open=True) + id = container['Id'] + self.client.start(id) + self.tmp_containers.append(id) + + res = self.client.exec_create(id, 'whoami', user='default') + self.assertIn('Id', res) + + exec_log = self.client.exec_start(res) + expected = b'default' if six.PY3 else 'default\n' + self.assertEqual(exec_log, expected) + + +@unittest.skipIf(not EXEC_DRIVER_IS_NATIVE, 'Exec driver not native') +class TestExecuteCommandStringAsRoot(BaseTestCase): + def runTest(self): + container = self.client.create_container('busybox', 'cat', + detach=True, stdin_open=True) + id = container['Id'] + self.client.start(id) + self.tmp_containers.append(id) + + res = self.client.exec_create(id, 'whoami') + self.assertIn('Id', res) + + exec_log = self.client.exec_start(res) + expected = b'root' if six.PY3 else 'root\n' + self.assertEqual(exec_log, expected) + + +@unittest.skipIf(not EXEC_DRIVER_IS_NATIVE, 'Exec driver not native') class TestExecuteCommandStreaming(BaseTestCase): def runTest(self): container = self.client.create_container('busybox', 'cat', |