diff options
author | Jhon Honce <jhonce@redhat.com> | 2018-05-24 13:44:04 -0700 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-05-25 09:31:21 +0000 |
commit | 0a4ade1c175d3188ad55d22d751a86c96e060a44 (patch) | |
tree | 9bfb3414119e931fd715c6d3002c0e357fce7e18 /contrib/python/test/test_images.py | |
parent | 684b544e9c45129a3d8112cfab22526440d8fd13 (diff) | |
download | podman-0a4ade1c175d3188ad55d22d751a86c96e060a44.tar.gz podman-0a4ade1c175d3188ad55d22d751a86c96e060a44.tar.bz2 podman-0a4ade1c175d3188ad55d22d751a86c96e060a44.zip |
Implement python podman create and start
- Added alias 'container()' to image model for CreateContainer()
- Fixed return in containers_create.go to wrap error in varlink
exception
- Added a wait time to container.kill(), number of seconds to wait
for the container to change state
- Refactored cached_property() to use system libraries
- Refactored tests to speed up performance
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Closes: #821
Approved by: rhatdan
Diffstat (limited to 'contrib/python/test/test_images.py')
-rw-r--r-- | contrib/python/test/test_images.py | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/contrib/python/test/test_images.py b/contrib/python/test/test_images.py index 02ca5b236..f9eaee139 100644 --- a/contrib/python/test/test_images.py +++ b/contrib/python/test/test_images.py @@ -46,8 +46,11 @@ class TestImages(PodmanTestCase): self.pclient.images.build() def test_create(self): - with self.assertRaisesNotImplemented(): - self.pclient.images.create() + actual = self.alpine_image.container() + self.assertIsNotNone(actual) + self.assertEqual(actual.status, 'configured') + cntr = actual.start() + self.assertIn(cntr.status, ['running', 'exited']) def test_export(self): path = os.path.join(self.tmpdir, 'alpine_export.tar') @@ -58,9 +61,7 @@ class TestImages(PodmanTestCase): self.assertTrue(os.path.isfile(path)) def test_history(self): - count = 0 - for record in self.alpine_image.history(): - count += 1 + for count, record in enumerate(self.alpine_image.history()): self.assertEqual(record.id, self.alpine_image.id) self.assertGreater(count, 0) @@ -89,13 +90,6 @@ class TestImages(PodmanTestCase): with self.assertRaises(podman.ErrorOccurred): self.alpine_image.remove() - # TODO: remove this block once force=True works - with podman.Client(self.host) as pclient: - for ctnr in pclient.containers.list(): - if 'alpine' in ctnr.image: - ctnr.stop() - ctnr.remove() - actual = self.alpine_image.remove(force=True) self.assertEqual(self.alpine_image.id, actual) after = self.loadCache() @@ -136,11 +130,11 @@ class TestImages(PodmanTestCase): def test_search(self): actual = self.pclient.images.search('alpine', 25) - names, lengths = itertools.tee(actual) + names, length = itertools.tee(actual) for img in names: - self.assertIn('alpine', img['name']) - self.assertTrue(0 < len(list(lengths)) <= 25) + self.assertIn('alpine', img.name) + self.assertTrue(0 < len(list(length)) <= 25) if __name__ == '__main__': |