Exemple #1
0
def test_present_installed(monkeypatch):
    monkeypatch.setattr(
        Cask, 'run',
        build_run(fixture_subpath='cask',
                  command_mappings=[
                      CommandMapping(
                          command=['brew', 'cask', 'list'],
                          stdout_filename='brew_cask_list_installed.stdout')
                  ]))

    cask = Cask(name='musescore', state='present')
    assert cask.process() == ActionResponse(changed=False)
Exemple #2
0
def test_list_command_invalid(monkeypatch):
    monkeypatch.setattr(
        Cask, 'run',
        build_run(fixture_subpath='cask',
                  command_mappings=[
                      CommandMapping(command=['brew', 'cask', 'list'],
                                     returncode=2)
                  ]))

    cask = Cask(name='musescore', state='present')
    with pytest.raises(ActionError):
        cask.process()
Exemple #3
0
def test_latest_installed_but_outdated(monkeypatch):
    monkeypatch.setattr(
        Cask, 'run',
        build_run(
            fixture_subpath='cask',
            command_mappings=[
                CommandMapping(
                    command=['brew', 'cask', 'list'],
                    stdout_filename='brew_cask_list_installed.stdout'),
                CommandMapping(
                    command=['brew', 'cask', 'outdated'],
                    stdout_filename='brew_cask_outdated_outdated.stdout'),
                CommandMapping(
                    command=['brew', 'cask', 'upgrade', 'musescore'])
            ]))

    cask = Cask(name='musescore', state='latest')
    assert cask.process() == ActionResponse(changed=True)
Exemple #4
0
def test_argument_state_invalid():
    with pytest.raises(ValueError):
        Cask(name='musescore', state='hmmm')