def test_purge_release(get_current, exists): get_current.return_value = 'ccc' exists.return_value = True with mock_history(initial=['aaa', 'bbb', 'ccc']) as releases: with patch('gonzo.tasks.release.sudo'): # skip rm purge_release('aaa') assert releases == ['bbb', 'ccc']
def test_purge_release_current(get_current, exists): get_current.return_value = 'bbb' exists.return_value = True with mock_history(initial=['aaa', 'bbb']) as releases: with patch('gonzo.tasks.release.sudo'): # skip rm with pytest.raises(RuntimeError): purge_release('bbb') assert releases == ['aaa', 'bbb']