summaryrefslogtreecommitdiff
path: root/contrib/python
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2018-07-06 10:53:48 -0700
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-06 21:59:36 +0000
commitca6ffbccc2b47ffe74bb74ebae5a61504203966c (patch)
treef3a55b4df5a9ea3a0a5d18392275cde59dce66cb /contrib/python
parentd61437f6892ca1527b263eb6c9850381c5f61b49 (diff)
downloadpodman-ca6ffbccc2b47ffe74bb74ebae5a61504203966c.tar.gz
podman-ca6ffbccc2b47ffe74bb74ebae5a61504203966c.tar.bz2
podman-ca6ffbccc2b47ffe74bb74ebae5a61504203966c.zip
Refactor unittest for change in history API
* test_images.TestImages.test_history changed to allow '<missing>' as legal image ID. Previously all layers used the image ID. Now layer 0 reports '<missing>'. Signed-off-by: Jhon Honce <jhonce@redhat.com> Closes: #1056 Approved by: jwhonce
Diffstat (limited to 'contrib/python')
-rw-r--r--contrib/python/test/test_images.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/contrib/python/test/test_images.py b/contrib/python/test/test_images.py
index c8c1814dc..c5695b722 100644
--- a/contrib/python/test/test_images.py
+++ b/contrib/python/test/test_images.py
@@ -1,6 +1,7 @@
import itertools
import os
import unittest
+from collections import Counter
from datetime import datetime, timezone
from test.podman_testcase import PodmanTestCase
@@ -81,9 +82,15 @@ class TestImages(PodmanTestCase):
self.assertEqual(actual, self.alpine_image)
def test_history(self):
- for count, record in enumerate(self.alpine_image.history()):
- self.assertEqual(record.id, self.alpine_image.id)
- self.assertGreater(count, 0)
+ records = []
+ bucket = Counter()
+ for record in self.alpine_image.history():
+ self.assertIn(record.id, (self.alpine_image.id, '<missing>'))
+ bucket[record.id] += 1
+ records.append(record)
+
+ self.assertGreater(bucket[self.alpine_image.id], 0)
+ self.assertEqual(sum(bucket.values()), len(records))
def test_inspect(self):
actual = self.alpine_image.inspect()