def test_arg_not_passed_in_auto_false(self, mock_ask): """If a value is not specified but and --auto was not requested, prompt the user. """ srvname = None auto = False fsm.get_srvname(srvname, auto) assert 1 == mock_ask.call_count
def test_arg_not_passed_in_auto_true(self, mock_ask): """If a value is not specified but --auto was requested, calculate and use a sane default. In this specific case there is no sane default, so blow up. """ srvname = None auto = True with raises(SystemExit) as err: fsm.get_srvname(srvname, auto) assert "I'd Really Rather You Didn't Use --auto Without --service-name" in err.value assert 0 == mock_ask.call_count
def test_arg_passed_in(self, mock_ask): """If a value is specified, use it.""" srvname = "services/fake" auto = "UNUSED" expected = srvname actual = fsm.get_srvname(srvname, auto) assert expected == actual assert 0 == mock_ask.call_count