diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-06-01 11:41:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-01 11:41:16 -0400 |
commit | 3f29e3e88110fd1a1c0b7d2058aa2c89dbb89c40 (patch) | |
tree | 8c52d190cf29a0d4f5fe958ada4c0e15ecfeebdd /contrib/python/test/test_containers.py | |
parent | ff3b46e769bc9a064ee8f45b9dbff8795d94bb7a (diff) | |
parent | 2cb881fa58a6a8fe6c89ec2885f01ebb3d74d871 (diff) | |
download | podman-3f29e3e88110fd1a1c0b7d2058aa2c89dbb89c40.tar.gz podman-3f29e3e88110fd1a1c0b7d2058aa2c89dbb89c40.tar.bz2 podman-3f29e3e88110fd1a1c0b7d2058aa2c89dbb89c40.zip |
Merge pull request #869 from jwhonce/wip/attach
Implement container attach
Diffstat (limited to 'contrib/python/test/test_containers.py')
-rw-r--r-- | contrib/python/test/test_containers.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/contrib/python/test/test_containers.py b/contrib/python/test/test_containers.py index 5c7c9934b..87d43adb4 100644 --- a/contrib/python/test/test_containers.py +++ b/contrib/python/test/test_containers.py @@ -1,11 +1,9 @@ import os import signal -import time import unittest from test.podman_testcase import PodmanTestCase import podman -from podman import datetime_parse class TestContainers(PodmanTestCase): @@ -65,8 +63,22 @@ class TestContainers(PodmanTestCase): self.pclient.containers.get("bozo") def test_attach(self): - with self.assertRaisesNotImplemented(): - self.alpine_ctnr.attach() + # StringIO does not support fileno() so we had to go old school + input = os.path.join(self.tmpdir, 'test_attach.stdin') + output = os.path.join(self.tmpdir, 'test_attach.stdout') + + with open(input, 'w+') as mock_in, open(output, 'w+') as mock_out: + # double quote is indeed in the expected place + mock_in.write('echo H"ello, World"; exit\n') + mock_in.seek(0, 0) + + self.alpine_ctnr.attach( + stdin=mock_in.fileno(), stdout=mock_out.fileno()) + + mock_out.flush() + mock_out.seek(0, 0) + output = mock_out.read() + self.assertIn('Hello', output) def test_processes(self): actual = list(self.alpine_ctnr.processes()) |