def execute(self, options, args, tool): filename = args[0] if not tool.filesystem.isfile(filename): print "The given path is not a file, please pass a valid path." return ids = set() inputfile = tool.filesystem.open_text_file_for_reading(filename) for line in inputfile: result = re.search( "(https://bugs\.webkit\.org/show_bug\.cgi\?id=|webkit\.org/b/)([0-9]+)", line) if result: ids.add(result.group(2)) inputfile.close() resolved_ids = set() num_of_bugs = len(ids) bugzilla = Bugzilla() for i, bugid in enumerate(ids, start=1): bug = bugzilla.fetch_bug(bugid) print "Checking bug %s \t [%d/%d]" % (bugid, i, num_of_bugs) if not bug.is_open(): resolved_ids.add(bugid) print "Resolved bugs in %s :" % (filename) for bugid in resolved_ids: print "https://bugs.webkit.org/show_bug.cgi?id=%s" % (bugid)
def test_attachment_parsing(self): bugzilla = Bugzilla() soup = BeautifulSoup(self._example_attachment) attachment_element = soup.find("attachment") attachment = bugzilla._parse_attachment_element(attachment_element, self._expected_example_attachment_parsing['bug_id']) self.assertTrue(attachment) self._assert_dictionaries_equal(attachment, self._expected_example_attachment_parsing)
def execute(self, options, args, tool): filename = args[0] if not tool.filesystem.isfile(filename): print "The given path is not a file, please pass a valid path." return ids = set() inputfile = tool.filesystem.open_text_file_for_reading(filename) for line in inputfile: result = re.search("(https://bugs\.webkit\.org/show_bug\.cgi\?id=|webkit\.org/b/)([0-9]+)", line) if result: ids.add(result.group(2)) inputfile.close() resolved_ids = set() num_of_bugs = len(ids) bugzilla = Bugzilla() for i, bugid in enumerate(ids, start=1): bug = bugzilla.fetch_bug(bugid) print "Checking bug %s \t [%d/%d]" % (bugid, i, num_of_bugs) if not bug.is_open(): resolved_ids.add(bugid) print "Resolved bugs in %s :" % (filename) for bugid in resolved_ids: print "https://bugs.webkit.org/show_bug.cgi?id=%s" % (bugid)
def test_add_cc_to_bug(self): bugzilla = Bugzilla() bugzilla.browser = MockBrowser() bugzilla.authenticate = lambda: None expected_stderr = "Adding ['*****@*****.**'] to the CC list for bug 42\n" OutputCapture().assert_outputs(self, bugzilla.add_cc_to_bug, [42, ["*****@*****.**"]], expected_stderr=expected_stderr)
def _assert_reopen(self, item_names=None, selected_index=None, extra_stderr=None): bugzilla = Bugzilla() bugzilla.browser = MockBrowser() bugzilla.authenticate = lambda: None mock_find_control = self._mock_find_control(item_names, selected_index) bugzilla.browser.find_control = mock_find_control expected_stderr = "Re-opening bug 42\n['comment']\n" if extra_stderr: expected_stderr += extra_stderr OutputCapture().assert_outputs(self, bugzilla.reopen_bug, [42, ["comment"]], expected_stderr=expected_stderr)
def test_parse_bug_id(self): # FIXME: These would be all better as doctests bugs = Bugzilla() self.assertEquals(12345, parse_bug_id("http://webkit.org/b/12345")) self.assertEquals(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345")) self.assertEquals(12345, parse_bug_id(bugs.short_bug_url_for_bug_id(12345))) self.assertEquals(12345, parse_bug_id(bugs.bug_url_for_bug_id(12345))) self.assertEquals(12345, parse_bug_id(bugs.bug_url_for_bug_id(12345, xml=True))) # Our bug parser is super-fragile, but at least we're testing it. self.assertEquals(None, parse_bug_id("http://www.webkit.org/b/12345")) self.assertEquals(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&id=12345"))
def __init__(self, path): MultiCommandTool.__init__(self) self._path = path self.wakeup_event = threading.Event() self.bugs = Bugzilla() self.buildbot = BuildBot() self.executive = Executive() self._irc = None self.user = User() self._scm = None self._checkout = None self.status_server = StatusServer() self.codereview = Rietveld(self.executive)
def test_attachment_detail_bug_parsing(self): bugzilla = Bugzilla() self.assertEquals(27314, bugzilla._parse_bug_id_from_attachment_page(self._sample_attachment_detail_page))
def test_url_creation(self): # FIXME: These would be all better as doctests bugs = Bugzilla() self.assertEquals(None, bugs.bug_url_for_bug_id(None)) self.assertEquals(None, bugs.short_bug_url_for_bug_id(None)) self.assertEquals(None, bugs.attachment_url_for_id(None))
def __init__(self, dryrun=False, committers=None): Bugzilla.__init__(self, dryrun, committers) self.queries = RIMBugzillaQueries(self)
def test_attachment_detail_bug_parsing(self): bugzilla = Bugzilla() self.assertEquals( 27314, bugzilla._parse_bug_id_from_attachment_page( self._sample_attachment_detail_page))
def test_bug_parsing(self): bug = Bugzilla()._parse_bug_page(self._example_bug) self._assert_dictionaries_equal(bug, self._expected_example_bug_parsing)