def test_activate_existing(get_current, set_current, get_commit): get_current.return_value = 'bbb' get_commit.return_value = 'aaa' with mock_history(initial=['aaa', 'bbb']) as releases: activate() assert releases == ['aaa', 'bbb', 'aaa'] assert_called_once_with(set_current, 'aaa')
def test_set(self, check_output): state = LocalState() state.git_args = ['cmd'] check_output.return_value = "bar" assert state['foo'] == 'bar' assert_called_once_with(check_output, ['cmd', 'gonzo.foo'])
def test_missing_home(self, os, imp): os.path.exists.return_value = False imp.find_module.return_value = Mock(), Mock(), Mock() get_config_module() assert_called_once_with(os.mkdir, ANY)
def test_set(self, local_state): set_project('foo') assert_called_once_with(local_state.__setitem__, 'project', 'foo')
def test_set(self, global_state): set_region('foo') assert_called_once_with(global_state.__setitem__, 'region', 'foo')
def test_rollback(get_current, set_current): get_current.return_value = 'bbb' with mock_history(initial=['aaa', 'bbb']) as releases: rollback() assert releases == ['aaa'] assert_called_once_with(set_current, 'aaa')