コード例 #1
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testGetDaysInStates(self):
        """
        Work is getting stuck in CA for ages.  We want to see for how long.
        To start with we'll just find out how long has something been in its current state
        """

        histories = [mockHistory(u'2012-11-18T09:54:29.284+0000', [mockItem('status', 'queued', START_STATE)]),
                     mockHistory(u'2012-11-28T09:54:29.284+0000', [mockItem('status', START_STATE, 'pending')]),
                     mockHistory(u'2012-11-30T09:54:29.284+0000', [mockItem('status', 'pending', END_STATE)])]

        created = date(2012, 11, 16)
        today = date(2012, 12, 02)

        actual = time_in_states(histories, created, today)

        expected = [{'state': 'Open',
                     'days':  2},
                    {'state': START_STATE,
                     'days':  10},
                    {'state': 'pending',
                     'days':  2},
                    {'state': END_STATE,
                     'days':  2}]

        assert actual == expected, actual
コード例 #2
0
    def testGetDaysInStates(self):
        """
        Work is getting stuck in CA for ages.  We want to see for how long.
        To start with we'll just find out how long has something been in its current state
        """

        histories = [
            mockHistory(u'2012-11-18T09:54:29.284+0000',
                        [mockItem('status', 'queued', START_STATE)]),
            mockHistory(u'2012-11-28T09:54:29.284+0000',
                        [mockItem('status', START_STATE, 'pending')]),
            mockHistory(u'2012-11-30T09:54:29.284+0000',
                        [mockItem('status', 'pending', END_STATE)])
        ]

        created = date(2012, 11, 16)
        today = date(2012, 12, 02)

        actual = time_in_states(histories, created, today)

        expected = [{
            'state': 'Open',
            'days': 2
        }, {
            'state': START_STATE,
            'days': 10
        }, {
            'state': 'pending',
            'days': 2
        }, {
            'state': END_STATE,
            'days': 2
        }]

        assert actual == expected, actual
コード例 #3
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testGetHistoryFromJiraChangeLog(self):

        """
        Generate the internal daily history of a Jira issue from its ChangeLog

        As part of the refactoring to make Cycle Time and Throughput use the internal
        representation of history rather than the Jira ChangeLog Histories we want the
        internal representation of an issue to contain its history in this form.

        This also sets us up for the FogBugz integration which will see us decouple all
        the Jira specific stuff from the internal data wrangling.
        """

        source = mockChangelog([mockHistory(u'2012-01-02T09:54:29.284+0000', [mockItem('status', CREATED_STATE, 'queued')]),
                                mockHistory(u'2012-01-03T09:54:29.284+0000', [mockItem('status', 'queued', START_STATE)]),
                                mockHistory(u'2012-01-13T09:54:29.284+0000', [mockItem('status', START_STATE, END_STATE)])])

        expected = pd.Series([CREATED_STATE,
                             'queued',
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             START_STATE,
                             END_STATE],
                             index=pd.to_datetime(['2012-01-01',
                                                   '2012-01-02',
                                                   '2012-01-03',
                                                   '2012-01-04',
                                                   '2012-01-05',
                                                   '2012-01-06',
                                                   '2012-01-07',
                                                   '2012-01-08',
                                                   '2012-01-09',
                                                   '2012-01-10',
                                                   '2012-01-11',
                                                   '2012-01-12',
                                                   '2012-01-13']))

        actual = history_from_jira_changelog(source, date(2012, 01, 01))

        assert_series_equal(actual, expected)
コード例 #4
0
    def testGetArrivals(self):
        """
        In order to work out the arrival rate we need to be able to get the days a ticket arrived
        in each of the states in its history.
        """

        histories = [
            mockHistory(u'2012-11-18T09:54:29.284+0000',
                        [mockItem('status', 'start', 'QA Queue')]),
            mockHistory(u'2012-11-18T09:54:29.284+0000',
                        [mockItem('status', 'QA Queue', 'Customer Queue')]),
            mockHistory(
                u'2012-11-22T09:54:29.284+0000',
                [mockItem('status', 'Customer Queue', 'Customer Review')])
        ]

        expected = {
            date(2012, 11, 18): {
                'QA Queue': 1,
                'Customer Queue': 1
            },
            date(2012, 11, 22): {
                'Customer Review': 1
            }
        }

        actual = arrivals(histories)

        self.assertEquals(actual, expected)

        actual = arrivals(histories, actual)

        expected_twice = {
            date(2012, 11, 18): {
                'QA Queue': 2,
                'Customer Queue': 2
            },
            date(2012, 11, 22): {
                'Customer Review': 2
            }
        }

        self.assertEquals(actual, expected_twice)
コード例 #5
0
ファイル: test_get_history.py プロジェクト: gbeine/jlf
    def testGetArrivals(self):
        """
        In order to work out the arrival rate we need to be able to get the days a ticket arrived
        in each of the states in its history.
        """

        histories = [mockHistory(u'2012-11-18T09:54:29.284+0000', [mockItem('status', 'start', 'QA Queue')]),
                     mockHistory(u'2012-11-18T09:54:29.284+0000', [mockItem('status', 'QA Queue', 'Customer Queue')]),
                     mockHistory(u'2012-11-22T09:54:29.284+0000', [mockItem('status', 'Customer Queue', 'Customer Review')])]

        expected = {date(2012, 11, 18): {'QA Queue': 1, 'Customer Queue': 1},
                    date(2012, 11, 22): {'Customer Review': 1}}

        actual = arrivals(histories)

        self.assertEquals(actual, expected)

        actual = arrivals(histories, actual)

        expected_twice = {date(2012, 11, 18): {'QA Queue': 2, 'Customer Queue': 2},
                          date(2012, 11, 22): {'Customer Review': 2}}

        self.assertEquals(actual, expected_twice)
コード例 #6
0
    def testGetHistoryFromJiraChangeLog(self):
        """
        Generate the internal daily history of a Jira issue from its ChangeLog

        As part of the refactoring to make Cycle Time and Throughput use the internal
        representation of history rather than the Jira ChangeLog Histories we want the
        internal representation of an issue to contain its history in this form.

        This also sets us up for the FogBugz integration which will see us decouple all
        the Jira specific stuff from the internal data wrangling.
        """

        source = mockChangelog([
            mockHistory(u'2012-01-02T09:54:29.284+0000',
                        [mockItem('status', CREATED_STATE, 'queued')]),
            mockHistory(u'2012-01-03T09:54:29.284+0000',
                        [mockItem('status', 'queued', START_STATE)]),
            mockHistory(u'2012-01-13T09:54:29.284+0000',
                        [mockItem('status', START_STATE, END_STATE)])
        ])

        expected = pd.Series([
            CREATED_STATE, 'queued', START_STATE, START_STATE, START_STATE,
            START_STATE, START_STATE, START_STATE, START_STATE, START_STATE,
            START_STATE, START_STATE, END_STATE
        ],
                             index=pd.to_datetime([
                                 '2012-01-01', '2012-01-02', '2012-01-03',
                                 '2012-01-04', '2012-01-05', '2012-01-06',
                                 '2012-01-07', '2012-01-08', '2012-01-09',
                                 '2012-01-10', '2012-01-11', '2012-01-12',
                                 '2012-01-13'
                             ]))

        actual = history_from_jira_changelog(source, date(2012, 01, 01))

        assert_series_equal(actual, expected)