summaryrefslogtreecommitdiff
path: root/test/python/docker
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-03-18 12:17:11 -0700
committerJhon Honce <jhonce@redhat.com>2021-03-19 09:25:12 -0700
commit417f36281129434cfa57fcaffb7f10b28b36e2e6 (patch)
tree90be7fc3ea5a614dcc889ade4477ec6483b91a89 /test/python/docker
parent5325957d536be3515fb7a782e4755afca38fca4c (diff)
downloadpodman-417f36281129434cfa57fcaffb7f10b28b36e2e6.tar.gz
podman-417f36281129434cfa57fcaffb7f10b28b36e2e6.tar.bz2
podman-417f36281129434cfa57fcaffb7f10b28b36e2e6.zip
Cleanup /libpod/images/load handler
* Remove orphaned code * Add meaningful error from LoadImageFromSingleImageArchive() when heuristic fails to determine payload format * Correct swagger to output correct types and headers Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'test/python/docker')
-rw-r--r--test/python/docker/compat/test_images.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/test/python/docker/compat/test_images.py b/test/python/docker/compat/test_images.py
index 4a90069a9..571b31881 100644
--- a/test/python/docker/compat/test_images.py
+++ b/test/python/docker/compat/test_images.py
@@ -1,4 +1,5 @@
import collections
+import io
import os
import subprocess
import sys
@@ -6,6 +7,7 @@ import time
import unittest
from docker import DockerClient, errors
+from docker.errors import APIError
from test.python.docker import Podman
from test.python.docker.compat import common, constant
@@ -79,9 +81,7 @@ class TestImages(unittest.TestCase):
self.assertEqual(len(self.client.images.list()), 2)
# List images with filter
- self.assertEqual(
- len(self.client.images.list(filters={"reference": "alpine"})), 1
- )
+ self.assertEqual(len(self.client.images.list(filters={"reference": "alpine"})), 1)
def test_search_image(self):
"""Search for image"""
@@ -149,15 +149,22 @@ class TestImages(unittest.TestCase):
self.assertEqual(len(self.client.images.list()), 2)
+ def test_load_corrupt_image(self):
+ """Import|Load Image failure"""
+ tarball = io.BytesIO("This is a corrupt tarball".encode("utf-8"))
+ with self.assertRaises(APIError):
+ self.client.images.load(tarball)
+
def test_build_image(self):
labels = {"apple": "red", "grape": "green"}
- _ = self.client.images.build(path="test/python/docker/build_labels", labels=labels, tag="labels")
+ _ = self.client.images.build(
+ path="test/python/docker/build_labels", labels=labels, tag="labels"
+ )
image = self.client.images.get("labels")
self.assertEqual(image.labels["apple"], labels["apple"])
self.assertEqual(image.labels["grape"], labels["grape"])
-
if __name__ == "__main__":
# Setup temporary space
unittest.main()