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'])
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')
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)
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")
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)
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 ''))