Esempio n. 1
0
def test_execute_installs_requirements(patched_ansible_playbook,
                                       patched_ansible_galaxy,
                                       patched_print_info, molecule_instance):
    molecule_instance.config.config['ansible']['requirements_file'] = str()

    s = syntax.Syntax({}, {}, molecule_instance)
    s.execute()

    patched_ansible_galaxy.assert_called_once_with()
    patched_ansible_playbook.assert_called_once_with(hide_errors=True)
Esempio n. 2
0
def test_execute(mocker, patched_ansible_playbook, patched_print_info,
                 molecule_instance):
    patched_ansible_playbook.return_value = 'returned'

    s = syntax.Syntax({}, {}, molecule_instance)
    result = s.execute()

    msg = "Checking playbook's syntax ..."
    patched_print_info.assert_called_once_with(msg)
    patched_ansible_playbook.assert_called_once_with(hide_errors=True)
    assert 'returned' == result
Esempio n. 3
0
def test_execute(mocker, patched_logger_info, _patched_ansible_syntax,
                 patched_config_validate, config_instance):
    s = syntax.Syntax(config_instance)
    s.execute()

    x = [
        mocker.call("Scenario: 'default'"),
        mocker.call("Action: 'syntax'"),
    ]
    assert x == patched_logger_info.mock_calls

    _patched_ansible_syntax.assert_called_once_with()
Esempio n. 4
0
def test_execute(mocker, patched_logger_info, patched_ansible_syntax,
                 config_instance):
    s = syntax.Syntax(config_instance)
    s.execute()
    x = [
        mocker.call('Scenario: [default]'),
        mocker.call('Provisioner: [ansible]'),
        mocker.call('Syntax Verification of Playbook: [playbook.yml]')
    ]

    assert x == patched_logger_info.mock_calls

    patched_ansible_syntax.assert_called_once_with()
Esempio n. 5
0
def test_execute(
    mocker,
    patched_logger_info,
    _patched_ansible_syntax,
    patched_config_validate,
    config_instance,
):
    s = syntax.Syntax(config_instance)
    s.execute()

    assert len(patched_logger_info.mock_calls) == 1
    name, args, kwargs = patched_logger_info.mock_calls[0]
    assert "default" in args
    assert "syntax" in args

    _patched_ansible_syntax.assert_called_once_with()