コード例 #1
0
 def test_url_for_issue(self):
     mock_browser = MockBrowser()
     status_server = StatusServer(browser=mock_browser, bot_id='123')
     status_server.update_status('queue name', 'the status')
     self.assertEqual('queue name', mock_browser.params['queue_name'])
     self.assertEqual('the status', mock_browser.params['status'])
     self.assertEqual('123', mock_browser.params['bot_id'])
コード例 #2
0
 def test_submit_to_ews(self):
     with OutputCapture():
         mock_browser = MockBrowser()
         ews_server = EWSServer(browser=mock_browser)
         self.assertTrue(ews_server.use_https)
         ews_server.submit_to_ews(10008)
         self.assertEqual(mock_browser['patch_id'], u'10008')
コード例 #3
0
 def test_add_cc_to_bug(self):
     bugzilla = Bugzilla()
     bugzilla.browser = MockBrowser()
     bugzilla.authenticate = lambda: None
     expected_logs = "Adding ['*****@*****.**'] to the CC list for bug 42\n"
     OutputCapture().assert_outputs(self,
                                    bugzilla.add_cc_to_bug,
                                    [42, ["*****@*****.**"]],
                                    expected_logs=expected_logs)
コード例 #4
0
 def test_add_cc_to_bug(self):
     bugzilla = Bugzilla()
     bugzilla.browser = MockBrowser()
     bugzilla.authenticate = lambda: None
     with OutputCapture(level=logging.INFO) as captured:
         bugzilla.add_cc_to_bug(42, ['*****@*****.**'])
     self.assertEqual(
         captured.root.log.getvalue(),
         "Adding ['*****@*****.**'] to the CC list for bug 42\n")
コード例 #5
0
    def _assert_reopen(self, item_names=None, selected_index=None, extra_logs=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_logs = "Re-opening bug 42\n['comment']\n"
        if extra_logs:
            expected_logs += extra_logs
        OutputCapture().assert_outputs(self, bugzilla.reopen_bug, [42, ["comment"]], expected_logs=expected_logs)
コード例 #6
0
    def _assert_reopen(self,
                       item_names=None,
                       selected_index=None,
                       extra_logs=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
        with OutputCapture(level=logging.INFO) as captured:
            bugzilla.reopen_bug(42, ['comment'])
        self.assertEqual(
            captured.root.log.getvalue(),
            "Re-opening bug 42\n['comment']\n" + (extra_logs or ''))