mirror of https://github.com/docker/docker-py.git
Add test for root user as default exec_create behaviour
This commit is contained in:
parent
a12818a8a8
commit
7bbec93f64
|
@ -846,6 +846,23 @@ class TestExecuteCommandStringAsUser(BaseTestCase):
|
|||
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):
|
||||
|
|
Loading…
Reference in New Issue