示例#1
0
    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
示例#2
0
    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
示例#3
0
    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()
示例#4
0
    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()
示例#5
0
    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()
示例#6
0
    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()
示例#7
0
    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)
示例#8
0
    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)