def _parse_bugs_from_xml(self, page): soup = BeautifulSoup(page) # Without the unicode() call, BeautifulSoup occasionally complains of being # passed None for no apparent reason. return [ Bug(self._parse_bug_dictionary_from_xml(unicode(bug_xml)), self) for bug_xml in soup('bug') ]
def fetch_bug(self, bug_id): bug_dictionary = self.fetch_bug_dictionary(bug_id) if bug_dictionary: return Bug(bug_dictionary, self) return None
def fetch_bug(self, bug_id): return Bug(self.fetch_bug_dictionary(bug_id), self)
def fetch_bug(self, bug_id): return Bug(self.bug_cache.get(int(bug_id)), self)
def _all_bugs(self): return map(lambda bug_dictionary: Bug(bug_dictionary, self._bugzilla), self._bugzilla.bug_cache.values())
def test_commit_revision(self): bug = Bug({"comments": []}, bugzilla=None) self.assertEqual(bug.commit_revision(), None) bug = Bug({"comments": [ {"text": "Comment 1"}, {"text": "Comment 2"}, ]}, bugzilla=None) self.assertEqual(bug.commit_revision(), None) bug = Bug({"comments": [ {"text": "Committed r138776: <https://trac.webkit.org/changeset/138776>"}, ]}, bugzilla=None) self.assertEqual(bug.commit_revision(), 138776) bug = Bug({"comments": [ {"text": "(From update of attachment 181269) Clearing flags on attachment: 181269 Committed r138776: <https://trac.webkit.org/changeset/138776>"}, ]}, bugzilla=None) self.assertEqual(bug.commit_revision(), 138776) bug = Bug({"comments": [ {"text": "Comment before"}, {"text": "(From update of attachment 181269) Clearing flags on attachment: 181269 Committed r138776: <https://trac.webkit.org/changeset/138776>"}, {"text": "Comment after"}, ]}, bugzilla=None) self.assertEqual(bug.commit_revision(), 138776) bug = Bug({"comments": [ {"text": "Comment before"}, {"text": "(From update of attachment 181269) Clearing flags on attachment: 181269 Committed r138776: <https://trac.webkit.org/changeset/138776>"}, {"text": "Comment Middle"}, {"text": "(From update of attachment 181280) Clearing flags on attachment: 181280 Committed r138976: <https://trac.webkit.org/changeset/138976>"}, {"text": "Comment After"}, ]}, bugzilla=None) self.assertEqual(bug.commit_revision(), 138976)
def test_is_in_comments(self): bug = Bug({"comments": [{"text": "Message1."}, {"text": "Message2. Message3. Message4."}, ], }, bugzilla=None) self.assertTrue(bug.is_in_comments("Message3.")) self.assertFalse(bug.is_in_comments("Message."))
def test_is_unassigned(self): for email in Bug.unassigned_emails: bug = Bug({"assigned_to_email": email}, bugzilla=None) self.assertTrue(bug.is_unassigned()) bug = Bug({"assigned_to_email": "*****@*****.**"}, bugzilla=None) self.assertFalse(bug.is_unassigned())