def test_bug_lookup_fails(self): """Assert ``False`` is returned if the bug cannot be found.""" def bomb(_): """A function that mocks a failure to fetch a bug.""" raise decorators.BugFetchError decorators._get_redmine_bug_status_id = bomb self.assertFalse(decorators.rm_bug_is_open(self.bug_id))
def test_bug_is_closed(self): """Assert ``False`` is returned if the bug is closed.""" decorators._get_redmine_bug_status_id = lambda bug_id: 1 self.assertFalse(decorators.rm_bug_is_open(self.bug_id)) decorators._get_redmine_bug_status_id = lambda bug_id: 2 self.assertFalse(decorators.rm_bug_is_open(self.bug_id))
def test_bug_is_open(self): """Assert ``True`` is returned if the bug is open.""" decorators._get_redmine_bug_status_id = lambda bug_id: 0 self.assertTrue(decorators.rm_bug_is_open(self.bug_id)) decorators._get_redmine_bug_status_id = lambda bug_id: 3 self.assertTrue(decorators.rm_bug_is_open(self.bug_id))