summaryrefslogtreecommitdiff
path: root/contrib/python/test
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2018-07-10 12:12:59 -0700
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-12 01:38:30 +0000
commit86154b6538c1fec69fde14f2d4b35c31dcc10b35 (patch)
tree8c83e9dcd85da19cbf34ed894894a2dc4bdb1c9f /contrib/python/test
parent7f3f49139694e447a05522efce97d3f8516d0ea2 (diff)
downloadpodman-86154b6538c1fec69fde14f2d4b35c31dcc10b35.tar.gz
podman-86154b6538c1fec69fde14f2d4b35c31dcc10b35.tar.bz2
podman-86154b6538c1fec69fde14f2d4b35c31dcc10b35.zip
Refactor attach()/start() after podman changes
* Update examples * Update/Clean up unittests * Add Mixins for container attach()/start() Signed-off-by: Jhon Honce <jhonce@redhat.com> Closes: #1080 Approved by: baude
Diffstat (limited to 'contrib/python/test')
-rw-r--r--contrib/python/test/test_containers.py11
-rw-r--r--contrib/python/test/test_images.py1
2 files changed, 8 insertions, 4 deletions
diff --git a/contrib/python/test/test_containers.py b/contrib/python/test/test_containers.py
index 87d43adb4..ec2dcde03 100644
--- a/contrib/python/test/test_containers.py
+++ b/contrib/python/test/test_containers.py
@@ -72,14 +72,18 @@ class TestContainers(PodmanTestCase):
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())
+ ctnr = self.pclient.images.get(self.alpine_ctnr.image).container(
+ detach=True, tty=True)
+ ctnr.attach(stdin=mock_in.fileno(), stdout=mock_out.fileno())
+ ctnr.start()
mock_out.flush()
mock_out.seek(0, 0)
output = mock_out.read()
self.assertIn('Hello', output)
+ ctnr.remove(force=True)
+
def test_processes(self):
actual = list(self.alpine_ctnr.processes())
self.assertGreaterEqual(len(actual), 2)
@@ -133,8 +137,7 @@ class TestContainers(PodmanTestCase):
def test_commit(self):
# TODO: Test for STOPSIGNAL when supported by OCI
# TODO: Test for message when supported by OCI
- details = self.pclient.images.get(
- self.alpine_ctnr.inspect().image).inspect()
+ details = self.pclient.images.get(self.alpine_ctnr.image).inspect()
changes = ['ENV=' + i for i in details.containerconfig['env']]
changes.append('CMD=/usr/bin/zsh')
changes.append('ENTRYPOINT=/bin/sh date')
diff --git a/contrib/python/test/test_images.py b/contrib/python/test/test_images.py
index c5695b722..14bf90992 100644
--- a/contrib/python/test/test_images.py
+++ b/contrib/python/test/test_images.py
@@ -62,6 +62,7 @@ class TestImages(PodmanTestCase):
actual = self.alpine_image.container()
self.assertIsNotNone(actual)
self.assertEqual(actual.status, 'configured')
+
ctnr = actual.start()
self.assertIn(ctnr.status, ['running', 'exited'])