def test_images_with_empty_tags(): """ docker 1.12 reports also images without tags with `null`. """ client = Mock() client.api_version = "1.24" client.images = Mock(return_value=[ { "Id": "sha256:abcde", "RepoTags": None }, { "Id": "sha256:abcdef" }, { "Id": "sha256:abcdefg", "RepoTags": ["image:latest"] }, ]) get_client_mock = MagicMock(return_value=client) with patch.object(docker_mod, "_get_client", get_client_mock): docker_mod._clear_context() result = docker_mod.images() assert result == {"sha256:abcdefg": {"RepoTags": ["image:latest"]}}
def test_images_with_empty_tags(self): ''' docker 1.12 reports also images without tags with `null`. ''' client = Mock() client.api_version = '1.24' client.images = Mock( return_value=[{'Id': 'sha256:abcde', 'RepoTags': None}, {'Id': 'sha256:abcdef'}, {'Id': 'sha256:abcdefg', 'RepoTags': ['image:latest']}]) get_client_mock = MagicMock(return_value=client) with patch.object(docker_mod, '_get_client', get_client_mock): docker_mod._clear_context() result = docker_mod.images() self.assertEqual(result, {'sha256:abcdefg': {'RepoTags': ['image:latest']}})
def test_images_with_empty_tags(self): """ docker 1.12 reports also images without tags with `null`. """ client = Mock() client.api_version = '1.24' client.images = Mock(return_value=[{ 'Id': 'sha256:abcde', 'RepoTags': None }, { 'Id': 'sha256:abcdef' }, { 'Id': 'sha256:abcdefg', 'RepoTags': ['image:latest'] }]) with patch.dict(docker_mod.__context__, {'docker.client': client}): docker_mod._clear_context() result = docker_mod.images() self.assertEqual(result, {'sha256:abcdefg': { 'RepoTags': ['image:latest'] }})