def test_team_not_passed_in_auto_true(self, mock_ask, mock_list_teams): """If a value is not specified but --auto was requested, calculate and use a sane default. """ team = None auto = True with raises(SystemExit) as err: fsm.get_monitoring_stanza(auto, team) assert "I'd Really Rather You Didn't Use --auto Without --team" in err.value assert 0 == mock_ask.call_count
def test_valid_team_passed_in(self, mock_ask, mock_list_teams): team = "red_jaguars" auto = "UNUSED" actual = fsm.get_monitoring_stanza(auto, team) assert ("team", team) in actual.items() assert ("service_type", "marathon") in actual.items()
def test_team_not_passed_in_auto_true_legacy_style_true(self, mock_ask, mock_list_teams): """If a value is not specified and --auto was requested and legacy_style is on, prompt the user. """ team = None auto = True mock_ask.return_value = "red_jaguars" actual = fsm.get_monitoring_stanza(auto, team, legacy_style=True) assert 1 == mock_ask.call_count assert ("team", mock_ask.return_value) in actual.items()
def test_team_not_passed_in_auto_false(self, mock_ask, mock_list_teams): """If a value is not specified but --auto was not requested, prompt the user. """ team = None auto = False mock_ask.return_value = "red_jaguars" actual = fsm.get_monitoring_stanza(auto, team) assert 1 == mock_ask.call_count assert ("team", mock_ask.return_value) in actual.items()
def test_service_type_marathon_when_legacy_style_true(self, mock_ask, mock_list_teams): team = "red_jaguars" auto = "UNUSED" actual = fsm.get_monitoring_stanza(auto, team, legacy_style=True) assert ("service_type", "classic") in actual.items()
def test_invalid_team_passed_in(self, mock_ask, mock_list_teams): team = "america world police" auto = "UNUSED" with raises(SystemExit): fsm.get_monitoring_stanza(auto, team)