diff options
author | Joffrey F <joffrey@docker.com> | 2018-01-26 15:32:04 -0800 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2018-01-26 16:23:55 -0800 |
commit | 388f291b13fca76f4974a1ee89225ff7f3afb85b (patch) | |
tree | d0eebd08f8b1c65448d33295b145d5d5276b681f /tests/integration/models_images_test.py | |
parent | deb8222d6994dca12be65146189859c9b76ed9a5 (diff) | |
download | docker-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/models_images_test.py')
-rw-r--r-- | tests/integration/models_images_test.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/integration/models_images_test.py b/tests/integration/models_images_test.py index 8840e15..2a28e12 100644 --- a/tests/integration/models_images_test.py +++ b/tests/integration/models_images_test.py @@ -1,9 +1,10 @@ import io +import tempfile import docker import pytest -from .base import BaseIntegrationTest, TEST_API_VERSION +from .base import BaseIntegrationTest, BUSYBOX, TEST_API_VERSION class ImageCollectionTest(BaseIntegrationTest): @@ -76,6 +77,20 @@ class ImageCollectionTest(BaseIntegrationTest): with pytest.raises(docker.errors.ImageLoadError): client.images.load('abc') + def test_save_and_load(self): + client = docker.from_env(version=TEST_API_VERSION) + image = client.images.get(BUSYBOX) + with tempfile.TemporaryFile() as f: + stream = image.save() + for chunk in stream: + f.write(chunk) + + f.seek(0) + result = client.images.load(f.read()) + + assert len(result) == 1 + assert result[0].id == image.id + class ImageTest(BaseIntegrationTest): |