Beispiel #1
0
def test_makefile_check():
    fake_makefile_path = 'UNUSED'
    fake_contents = "DOCKER_TAG ?= something\ntest:\n\tsomething\nitest:\n\tsomething"
    with contextlib.nested(
        patch(
            'paasta_tools.cli.cmds.check.get_file_contents',
            autospec=True,
            return_value=fake_contents
        ),
        patch(
            'paasta_tools.cli.cmds.check.makefile_has_a_tab',
        ),
        patch(
            'paasta_tools.cli.cmds.check.makefile_responds_to',
        ),
        patch(
            'paasta_tools.cli.cmds.check.makefile_has_docker_tag',
        ),
        patch(
            'paasta_tools.cli.cmds.check.is_file_in_dir',
            autospec=True,
            return_value=fake_makefile_path
        ),
    ) as (
        mock_get_file_contents,
        mock_makefile_has_a_tab,
        mock_makefile_responds_to,
        mock_makefile_has_docker_tag,
        mock_is_file_in_dir,
    ):
        makefile_check()
        assert mock_makefile_has_a_tab.call_count == 1
        calls = [call('test'), call('itest'), call('cook-image')]
        mock_makefile_responds_to.assert_has_calls(calls, any_order=True)
        assert mock_makefile_has_docker_tag.call_count == 1
Beispiel #2
0
def test_makefile_check():
    fake_makefile_path = 'UNUSED'
    fake_contents = "DOCKER_TAG ?= something\ntest:\n\tsomething\nitest:\n\tsomething"
    with patch(
        'paasta_tools.cli.cmds.check.get_file_contents',
        autospec=True,
        return_value=fake_contents,
    ), patch(
        'paasta_tools.cli.cmds.check.makefile_has_a_tab',
        autospec=True,
    ) as mock_makefile_has_a_tab, patch(
        'paasta_tools.cli.cmds.check.makefile_responds_to',
        autospec=True,
    ) as mock_makefile_responds_to, patch(
        'paasta_tools.cli.cmds.check.makefile_has_docker_tag',
        autospec=True,
    ) as mock_makefile_has_docker_tag, patch(
        'paasta_tools.cli.cmds.check.is_file_in_dir',
        autospec=True,
        return_value=fake_makefile_path,
    ):
        makefile_check()
        assert mock_makefile_has_a_tab.call_count == 1
        calls = [call('test'), call('itest'), call('cook-image')]
        mock_makefile_responds_to.assert_has_calls(calls, any_order=True)
        assert mock_makefile_has_docker_tag.call_count == 1