def test_list_output_invalid(monkeypatch): monkeypatch.setattr( Brew, 'run', build_run(fixture_subpath='brew', command_mappings=[ CommandMapping(command=['brew', 'list'], returncode=1) ])) brew = Brew(name='youtube-dl', state='present') with pytest.raises(ActionError): brew.process()
def test_present_installed(monkeypatch): monkeypatch.setattr( Brew, 'run', build_run(fixture_subpath='brew', command_mappings=[ CommandMapping( command=['brew', 'list'], stdout_filename='brew_list_installed.stdout') ])) brew = Brew(name='youtube-dl', state='present') assert brew.process() == ActionResponse(changed=False)
def test_latest_installed_and_up_to_date(monkeypatch): monkeypatch.setattr( Brew, 'run', build_run(fixture_subpath='brew', command_mappings=[ CommandMapping( command=['brew', 'list'], stdout_filename='brew_list_installed.stdout'), CommandMapping( command=['brew', 'outdated', '--json=v1'], stdout_filename='brew_outdated_up_to_date.stdout') ])) brew = Brew(name='youtube-dl', state='latest') assert brew.process() == ActionResponse(changed=False)
def test_argument_state_invalid(): with pytest.raises(ValueError): Brew(name='youtube-dl', state='hmmm')