diff options
author | Joffrey F <joffrey@docker.com> | 2018-01-30 16:13:46 -0800 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2018-01-30 16:47:04 -0800 |
commit | 17aa31456d99651c651683535243647508eec628 (patch) | |
tree | ca67643ecd1a7267b4da3952822b8660c6a91c2e /tests | |
parent | a05922e94940f90be5c136d8d5ffaeeba4c7d59c (diff) | |
download | docker-py-1761-dockerclient-pull.tar.gz |
Properly support pulling all tags in DockerClient.images.pull1761-dockerclient-pull
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/models_images_test.py | 6 | ||||
-rw-r--r-- | tests/integration/models_services_test.py | 3 | ||||
-rw-r--r-- | tests/unit/models_images_test.py | 17 |
3 files changed, 23 insertions, 3 deletions
diff --git a/tests/integration/models_images_test.py b/tests/integration/models_images_test.py index 9313916..2fa71a7 100644 --- a/tests/integration/models_images_test.py +++ b/tests/integration/models_images_test.py @@ -74,6 +74,12 @@ class ImageCollectionTest(BaseIntegrationTest): image = client.images.pull('alpine', tag='3.3') assert 'alpine:3.3' in image.attrs['RepoTags'] + def test_pull_multiple(self): + client = docker.from_env(version=TEST_API_VERSION) + images = client.images.pull('hello-world') + assert len(images) == 1 + assert 'hello-world:latest' in images[0].attrs['RepoTags'] + def test_load_error(self): client = docker.from_env(version=TEST_API_VERSION) with pytest.raises(docker.errors.ImageLoadError): diff --git a/tests/integration/models_services_test.py b/tests/integration/models_services_test.py index 39cccf8..cb8eca2 100644 --- a/tests/integration/models_services_test.py +++ b/tests/integration/models_services_test.py @@ -1,12 +1,12 @@ import unittest import docker +import pytest from .. import helpers from .base import TEST_API_VERSION from docker.errors import InvalidArgument from docker.types.services import ServiceMode -import pytest class ServiceTest(unittest.TestCase): @@ -182,6 +182,7 @@ class ServiceTest(unittest.TestCase): service.reload() assert not service.attrs['Spec'].get('Labels') + @pytest.mark.xfail(reason='Flaky test') def test_update_retains_networks(self): client = docker.from_env(version=TEST_API_VERSION) network_name = helpers.random_name() diff --git a/tests/unit/models_images_test.py b/tests/unit/models_images_test.py index 9ecb7e4..dacd72b 100644 --- a/tests/unit/models_images_test.py +++ b/tests/unit/models_images_test.py @@ -41,9 +41,22 @@ class ImageCollectionTest(unittest.TestCase): def test_pull(self): client = make_fake_client() - image = client.images.pull('test_image') + image = client.images.pull('test_image:latest') + client.api.pull.assert_called_with('test_image', tag='latest') + client.api.inspect_image.assert_called_with('test_image:latest') + assert isinstance(image, Image) + assert image.id == FAKE_IMAGE_ID + + def test_pull_multiple(self): + client = make_fake_client() + images = client.images.pull('test_image') client.api.pull.assert_called_with('test_image', tag=None) - client.api.inspect_image.assert_called_with('test_image') + client.api.images.assert_called_with( + all=False, name='test_image', filters=None + ) + client.api.inspect_image.assert_called_with(FAKE_IMAGE_ID) + assert len(images) == 1 + image = images[0] assert isinstance(image, Image) assert image.id == FAKE_IMAGE_ID |