def test_other_category(self): """ L{warn} returns C{False} if a L{Bug} isn't in the 'In progress' or 'Need review' categories. """ bug = Bug("1", "kanban", MEDIUM, QUEUED, "A title", "jkakar") self.assertFalse(warn(bug, 3, 1))
def test_in_progress_without_warning(self): """ L{warn} returns C{False} if a L{Bug} has been in progress for less than the specified threshold. """ now = datetime.utcnow() bug = Bug("1", "kanban", MEDIUM, IN_PROGRESS, "A title", "jkakar", now) self.assertFalse(warn(bug, 3, 1))
def test_in_progress_with_warning(self): """ L{warn} returns C{False} if a L{Bug} has been in progress for less than the specified threshold. """ in_progress_date = datetime(2011, 1, 31) bug = Bug("1", "kanban", MEDIUM, IN_PROGRESS, "A title", "jkakar", in_progress_date) now = datetime(2011, 2, 4) self.assertTrue(warn(bug, 3, 1, now))
def test_in_progress_skips_weekends(self): """ When L{warn} calculates the warning threshold date, it doesn't include weekends. """ in_progress_date = datetime(2011, 2, 4) bug = Bug("1", "kanban", MEDIUM, IN_PROGRESS, "A title", "jkakar", in_progress_date) # With the weekend, 3 days have passed, but the 2 weekend days are not # counted, so this bug isn't in a warning state yet. now = datetime(2011, 2, 7) self.assertFalse(warn(bug, 3, 1, now))
def test_needs_review_without_warning(self): """ L{warn} returns C{False} if a L{Bug} has been in progress for less than the specified threshold. """ now = datetime.utcnow() bug = Bug( "1", "kanban", MEDIUM, IN_PROGRESS, "A title", "jkakar", now, "lp:~username/project/branch", "https://code.launchpad.net/~username/project/branch/+merge/1234", NEEDS_REVIEW, now) self.assertFalse(warn(bug, 3, 1))
def test_needs_review_skips_weekends(self): """ When L{warn} calculates the warning threshold date, it doesn't include weekends. """ needs_review_date = datetime(2011, 2, 4) bug = Bug( "1", "kanban", MEDIUM, IN_PROGRESS, "A title", "jkakar", needs_review_date, "lp:~username/project/branch", "https://code.launchpad.net/~username/project/branch/+merge/1234", NEEDS_REVIEW, needs_review_date) # With the weekend, 3 days have passed, but the 2 weekend days are not # counted, so this bug isn't in a warning state yet. now = datetime(2011, 2, 7) self.assertFalse(warn(bug, 3, 1, now))