def test_regression_590725(self): """bug.body utf sometimes contains invalid continuation bytes.""" try: bts.get_bug_log(578363) bts.get_bug_log(570825) except UnicodeDecodeError: self.fail()
def test_regression_590725(): """bug.body utf sometimes contains invalid continuation bytes.""" try: bts.get_bug_log(578363) bts.get_bug_log(570825) except UnicodeDecodeError: pytest.fail()
def test_bug_log_message_unicode(self): """test parsing of bug_log mail with non ascii characters""" buglogs = bts.get_bug_log(773321) buglog = buglogs[1] msg_payload = buglog['message'].get_payload() self._assert_unicode(msg_payload) self.assertTrue('é' in msg_payload)
def _get_bug_log_thread(self, bug_num): try: bug_logs = bts.get_bug_log(bug_num) except Exception as exc: self._thread_failed = True print('threaded get_bug_log() call failed ' 'with exception {} {}'.format(type(exc), exc))
def get_report(number, timeout, system='debian', mirrors=None, http_proxy='', archived=False, followups=False): number = int(number) if system == 'debian': status = debianbts.get_status(number)[0] log = debianbts.get_bug_log(number) # add Date/Subject/From headers to the msg bodies bodies = [] for l in log: f = email.parser.FeedParser() f.feed(l['header']) h = f.close() hdrs = [] for i in ['Date', 'Subject', 'From']: if i in h: hdrs.append(i + ': ' + h.get(i)) bodies.append('\n'.join(sorted(hdrs)) + '\n\n' + l['body']) # returns the bug status and a list of mail bodies return (status, bodies) if SYSTEMS[system].get('cgiroot'): result = get_cgi_report(number, timeout, system, http_proxy, archived, followups) if result: return result url = report_url(system, number, mirrors) if not url: return None return parse_html_report(number, url, http_proxy, timeout, followups, cgi=False)
def test_bug_log_message_unicode(): """test parsing of bug_log mail with non ascii characters""" buglogs = bts.get_bug_log(773321) buglog = buglogs[2] msg_payload = buglog['message'].get_payload() assert is_unicode(msg_payload) assert 'é' in msg_payload
def test_bug_log_message_unicode(): """test parsing of bug_log mail with non ascii characters""" buglogs = bts.get_bug_log(773321) buglog = buglogs[2] msg_payload = buglog['message'].get_payload() assert isinstance(msg_payload, str) assert 'é' in msg_payload
def test_bug_log_message(): """dict returned by get_bug_log has a email.Message field""" buglogs = bts.get_bug_log(400012) for buglog in buglogs: assert 'message' in buglog msg = buglog['message'] assert isinstance(msg, email.message.Message) assert 'Subject' in msg if not msg.is_multipart(): assert isinstance(msg.get_payload(), str)
def test_bug_log_message(self): """dict returned by get_bug_log has a email.Message field""" buglogs = bts.get_bug_log(400012) for buglog in buglogs: self.assertTrue('message' in buglog) msg = buglog['message'] self.assertIsInstance(msg, email.message.Message) self.assertFalse(msg.is_multipart()) self.assertTrue('Subject' in msg) self._assert_unicode(msg.get_payload())
def test_bug_log_message(): """dict returned by get_bug_log has a email.Message field""" buglogs = bts.get_bug_log(400012) for buglog in buglogs: assert 'message' in buglog msg = buglog['message'] assert isinstance(msg, email.message.Message) assert 'Subject' in msg if not msg.is_multipart(): assert is_unicode(msg.get_payload())
def test_get_bug_log(self): """get_bug_log should return the correct data types.""" bl = bts.get_bug_log(223344) self.assertEqual(type(bl), type([])) for i in bl: self.assertEqual(type(i), type(dict())) self.assertTrue("attachments" in i) self.assertEqual(type(i["attachments"]), type(list())) self.assertTrue("body" in i) self.assertTrue(isinstance(i["body"], type(''))) self.assertTrue("header" in i) self.assertTrue(isinstance(i["header"], type(''))) self.assertTrue("msg_num" in i) self.assertEqual(type(i["msg_num"]), type(int()))
def test_get_bug_log(): """get_bug_log should return the correct data types.""" bl = bts.get_bug_log(223344) assert isinstance(bl, list) for i in bl: assert isinstance(i, dict) assert "attachments" in i assert isinstance(i["attachments"], list) assert "body" in i assert isinstance(i["body"], str) assert "header" in i assert isinstance(i["header"], str) assert "msg_num" in i assert isinstance(i["msg_num"], int)
def test_get_bug_log(): """get_bug_log should return the correct data types.""" bl = bts.get_bug_log(223344) assert isinstance(bl, list) for i in bl: assert isinstance(i, dict) assert "attachments" in i assert isinstance(i["attachments"], list) assert "body" in i assert is_unicode(i["body"]) assert "header" in i assert is_unicode(i["header"]) assert "msg_num" in i assert isinstance(i["msg_num"], int)
def testGetBugLog(self): """get_bug_log should return the correct data types.""" bl = bts.get_bug_log(223344) self.assertEqual(type(bl), type([])) for i in bl: self.assertEqual(type(i), type(dict())) self.assertTrue(i.has_key("attachments")) self.assertEqual(type(i["attachments"]), type(list())) self.assertTrue(i.has_key("body")) self.assertEqual(type(i["body"]), type(unicode())) self.assertTrue(i.has_key("header")) self.assertEqual(type(i["header"]), type(unicode())) self.assertTrue(i.has_key("msg_num")) self.assertEqual(type(i["msg_num"]), type(int()))
def fetch_bug_log(bug_num): """Get a bug log (the sequence of comments) from the BTS :returns: Message-ID -> (author, body) dict """ ordered_bug_log = OrderedDict() for b in debianbts.get_bug_log(bug_num): try: msg_id = extract_msg_id(b['header']) except ParsingError: continue author = extract_msg_author(b['header']) ordered_bug_log[msg_id] = (author, b['body']) return ordered_bug_log
def test_regresssion_917258(): try: bts.get_bug_log(541147) except Exception: pytest.fail()
def test_regresssion_917165(): try: bts.get_bug_log(887978) except Exception: pytest.fail()
def test_get_bug_log_with_attachments(self): """get_bug_log should include attachments""" buglogs = bts.get_bug_log(400000) for bl in buglogs: self.assertTrue("attachments" in bl)
def test_regression_588954(): """Get_bug_log must convert the body correctly to unicode.""" try: bts.get_bug_log(582010) except UnicodeDecodeError: pytest.fail()
def test_base64_buglog_body(): """buglog body is sometimes base64 encoded""" buglog = bts.get_bug_log(773321) body = buglog[2]['body'] assert is_unicode(buglog[1]['body']) assert 'é' in body
def test_base64_buglog_body(self): """buglog body is sometimes base64 encoded""" buglog = bts.get_bug_log(773321) body = buglog[1]['body'] self._assert_unicode(buglog[1]['body']) self.assertTrue('é' in body)
def test_get_bug_log_with_attachments(): """get_bug_log should include attachments""" buglogs = bts.get_bug_log(400000) for bl in buglogs: assert "attachments" in bl
def test_regresssion_917165(): bts.get_bug_log(887978)
def test_regression_588954(): """Get_bug_log must convert the body correctly to unicode.""" bts.get_bug_log(582010)
def _get_bug_log_thread(self, bug_num): try: bts.get_bug_log(bug_num) except Exception: self._thread_failed = True logger.exception('Threaded get_bug_log() call failed.')
def test_regresssion_917258(): bts.get_bug_log(541147)
def test_regression_588954(self): """Get_bug_log must convert the body correctly to unicode.""" try: bts.get_bug_log(582010) except UnicodeDecodeError: self.fail()
def test_regression_590725(): """bug.body utf sometimes contains invalid continuation bytes.""" bts.get_bug_log(578363) bts.get_bug_log(570825)
def get_mia_maintainers(bug) -> Optional[List[str]]: import debianbts log = debianbts.get_bug_log(bug) return log[0]["message"].get_all("X-Debbugs-CC")
def test_base64_buglog_body(): """buglog body is sometimes base64 encoded""" buglog = bts.get_bug_log(773321) body = buglog[2]['body'] assert isinstance(buglog[1]['body'], str) assert 'é' in body