def test_get_all_images(mock_client): count = 7 mock_client.images.return_value = [mock.Mock() for _ in range(count)] with mock.patch('docker_custodian.docker_gc.log', autospec=True) as mock_log: images = docker_gc.get_all_images(mock_client) assert images == mock_client.images.return_value mock_log.info.assert_called_with("Found %s images", count)