summaryrefslogtreecommitdiff
path: root/tests/integration/api_image_test.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2018-01-26 15:32:04 -0800
committerJoffrey F <joffrey@docker.com>2018-01-26 16:23:55 -0800
commit388f291b13fca76f4974a1ee89225ff7f3afb85b (patch)
treed0eebd08f8b1c65448d33295b145d5d5276b681f /tests/integration/api_image_test.py
parentdeb8222d6994dca12be65146189859c9b76ed9a5 (diff)
downloaddocker-py-1774-export-methods.tar.gz
Update save / export methods to return data generators1774-export-methods
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests/integration/api_image_test.py')
-rw-r--r--tests/integration/api_image_test.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/integration/api_image_test.py b/tests/integration/api_image_test.py
index 178c34e..ae93190 100644
--- a/tests/integration/api_image_test.py
+++ b/tests/integration/api_image_test.py
@@ -329,7 +329,7 @@ class PruneImagesTest(BaseAPIIntegrationTest):
img_id = self.client.inspect_image('hello-world')['Id']
result = self.client.prune_images()
assert img_id not in [
- img.get('Deleted') for img in result['ImagesDeleted']
+ img.get('Deleted') for img in result.get('ImagesDeleted') or []
]
result = self.client.prune_images({'dangling': False})
assert result['SpaceReclaimed'] > 0
@@ -339,3 +339,25 @@ class PruneImagesTest(BaseAPIIntegrationTest):
assert img_id in [
img.get('Deleted') for img in result['ImagesDeleted']
]
+
+
+class SaveLoadImagesTest(BaseAPIIntegrationTest):
+ @requires_api_version('1.23')
+ def test_get_image_load_image(self):
+ with tempfile.TemporaryFile() as f:
+ stream = self.client.get_image(BUSYBOX)
+ for chunk in stream:
+ f.write(chunk)
+
+ f.seek(0)
+ result = self.client.load_image(f.read())
+
+ success = False
+ result_line = 'Loaded image: {}\n'.format(BUSYBOX)
+ for data in result:
+ print(data)
+ if 'stream' in data:
+ if data['stream'] == result_line:
+ success = True
+ break
+ assert success is True