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 test_flag_permission_rejection_message(self):
        bugzilla = Bugzilla()
        expected_messsage="""[email protected] does not have review permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/modules/committers.py.

- If you do not have review rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have review rights please correct the error in WebKitTools/Scripts/modules/committers.py by adding yourself to the file (no review needed).  Due to bug 30084 the commit-queue will require a restart after your change.  Please contact [email protected] to request a commit-queue restart.  After restart the commit-queue will correctly respect your review rights."""
        self.assertEqual(bugzilla._flag_permission_rejection_message("*****@*****.**", "review"), expected_messsage)
Exemple #3
0
 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)
Exemple #4
0
    def test_flag_permission_rejection_message(self):
        bugzilla = Bugzilla()
        expected_messsage = """[email protected] does not have review permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/modules/committers.py.

- If you do not have review rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have review rights please correct the error in WebKitTools/Scripts/modules/committers.py by adding yourself to the file (no review needed).  Due to bug 30084 the commit-queue will require a restart after your change.  Please contact [email protected] to request a commit-queue restart.  After restart the commit-queue will correctly respect your review rights."""
        self.assertEqual(
            bugzilla._flag_permission_rejection_message(
                "*****@*****.**", "review"), expected_messsage)
Exemple #5
0
 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 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 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)

        # Make sure we aren't parsing more or less than we expect
        self.assertEquals(attachment.keys(), self._expected_example_attachment_parsing.keys())

        for key, expected_value in self._expected_example_attachment_parsing.items():
            self.assertEquals(attachment[key], expected_value, ("Failure for key: %s: Actual='%s' Expected='%s'" % (key, attachment[key], expected_value)))
Exemple #8
0
    def test_attachment_parsing(self):
        reviewer = Reviewer('Test One', '*****@*****.**')
        committer = Committer('Test Two', '*****@*****.**')
        committer_list = CommitterList(committers=[committer], reviewers=[reviewer])
        bugzilla = Bugzilla(committers=committer_list)

        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)

        for key, expected_value in self._expected_example_attachment_parsing.items():
            self.assertEquals(attachment[key], expected_value, ("Failure for key: %s: Actual='%s' Expected='%s'" % (key, attachment[key], expected_value)))
Exemple #9
0
    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"))
Exemple #10
0
    def test_attachment_parsing(self):
        reviewer = Reviewer('Test One', '*****@*****.**')
        committer = Committer('Test Two', '*****@*****.**')
        committer_list = CommitterList(committers=[committer],
                                       reviewers=[reviewer])
        bugzilla = Bugzilla(committers=committer_list)

        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)

        for key, expected_value in self._expected_example_attachment_parsing.items(
        ):
            self.assertEquals(
                attachment[key], expected_value,
                ("Failure for key: %s: Actual='%s' Expected='%s'" %
                 (key, attachment[key], expected_value)))
Exemple #11
0
 def test_attachment_detail_bug_parsing(self):
     bugzilla = Bugzilla()
     self.assertEquals(
         27314,
         bugzilla._parse_bug_id_from_attachment_page(
             self._sample_attachment_detail_page))
Exemple #12
0
 def test_bug_parsing(self):
     bug = Bugzilla()._parse_bug_page(self._example_bug)
     self._assert_dictionaries_equal(bug,
                                     self._expected_example_bug_parsing)
 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 test_attachment_detail_bug_parsing(self):
     bugzilla = Bugzilla()
     self.assertEquals(27314, bugzilla._parse_bug_id_from_attachment_page(self._sample_attachment_detail_page))