예제 #1
0
    def test_long_history_length(self, mock_read_json):
        """ Test the length of a long history of a specific metric. """
        mock_read_json.return_value = {
            "dates": ["2013-02-28 17:01:45"] * 2001,
            "metrics": {
                "OpenBugsNone": [{
                    "value": 10,
                    "start": "2013-02-28 17:01:45",
                    "end": "2013-02-28 17:01:45",
                    "status": "yellow"
                }, {
                    "value": 38,
                    "start": "2013-02-28 17:16:45",
                    "end": "2013-03-05 17:16:45",
                    "status": "red"
                }]
            },
            "statuses": [{
                "yellow": 1
            }, {
                "red": 1
            }, {
                "red": 1
            }]
        }
        history = CompactHistory('history_file_name.json')

        self.assertEqual(2000, len(history.long_history('OpenBugsNone')))
예제 #2
0
    def test_long_history(self, mock_read_json):
        """ Test that the empty history file has no long history. """
        mock_read_json.return_value = {
            "dates": [],
            "metrics": {},
            "statuses": []
        }
        history = CompactHistory('history_file_name.json')

        self.assertEqual([], history.long_history('metric id'))
예제 #3
0
    def test_long_history_length(self, mock_read_json):
        """ Test the length of a long history of a specific metric. """
        mock_read_json.return_value = {
            "dates": ["2013-02-28 17:01:45"] * 2001,
            "metrics": {"OpenBugsNone": [
                {"value": 10, "start": "2013-02-28 17:01:45", "end": "2013-02-28 17:01:45", "status": "yellow"},
                {"value": 38, "start": "2013-02-28 17:16:45", "end": "2013-03-05 17:16:45", "status": "red"}]},
            "statuses": [{"yellow": 1}, {"red": 1}, {"red": 1}]
        }
        history = CompactHistory('history_file_name.json')

        self.assertEqual(2000, len(history.long_history('OpenBugsNone')))
예제 #4
0
    def test_long_history(self, mock_read_json):
        """ Test the long history of a specific metric. """
        mock_read_json.return_value = COMPACT_HISTORY
        history = CompactHistory('history_file_name.json')

        self.assertEqual([3, 10, 38, 38], history.long_history('OpenBugsNone'))
예제 #5
0
    def test_long_history(self, mock_read_json):
        """ Test that the empty history file has no long history. """
        mock_read_json.return_value = {"dates": [], "metrics": {}, "statuses": []}
        history = CompactHistory('history_file_name.json')

        self.assertEqual([], history.long_history('metric id'))
예제 #6
0
    def test_long_history(self, mock_read_json):
        """ Test the long history of a specific metric. """
        mock_read_json.return_value = COMPACT_HISTORY
        history = CompactHistory('history_file_name.json')

        self.assertEqual([3, 10, 38, 38], history.long_history('OpenBugsNone'))