Example #1
0
def test_remove_image_new_image_not_removed(mock_client, image, later_time):
    image_id = 'abcd'
    image_summary = {'Id': image_id}
    mock_client.inspect_image.return_value = image
    docker_gc.remove_image(mock_client, image_summary, later_time, False)

    assert not mock_client.remove_image.mock_calls
Example #2
0
def test_remove_image_no_tags(mock_client, image, now):
    image_id = 'abcd'
    image_summary = {'Id': image_id}
    mock_client.inspect_image.return_value = image
    docker_gc.remove_image(mock_client, image_summary, now, False)

    mock_client.remove_image.assert_called_once_with(image=image_id)
def test_remove_image_new_image_not_removed(mock_client, image, later_time):
    image_id = 'abcd'
    image_summary = dict(Id=image_id)
    mock_client.inspect_image.return_value = image
    docker_gc.remove_image(mock_client, image_summary, later_time, False)

    assert not mock_client.remove_image.mock_calls
def test_remove_image_no_tags(mock_client, image, now):
    image_id = 'abcd'
    image_summary = dict(Id=image_id)
    mock_client.inspect_image.return_value = image
    docker_gc.remove_image(mock_client, image_summary, now, False)

    mock_client.remove_image.assert_called_once_with(image_id)
Example #5
0
def test_remove_image_with_tags(mock_client, image, now):
    image_id = 'abcd'
    repo_tags = ['user/one:latest', 'user/one:12345']
    image_summary = {'Id': image_id, 'RepoTags': repo_tags}
    mock_client.inspect_image.return_value = image
    docker_gc.remove_image(mock_client, image_summary, now, False)

    assert mock_client.remove_image.mock_calls == [
        mock.call(image=tag) for tag in repo_tags
    ]
def test_remove_image_with_tags(mock_client, image, now):
    image_id = 'abcd'
    repo_tags = ['user/one:latest', 'user/one:12345']
    image_summary = dict(Id=image_id, RepoTags=repo_tags)
    mock_client.inspect_image.return_value = image
    docker_gc.remove_image(mock_client, image_summary, now, False)

    assert mock_client.remove_image.mock_calls == [
        mock.call(tag) for tag in repo_tags
    ]