Пример #1
0
 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()
Пример #2
0
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()
Пример #3
0
 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)
Пример #4
0
 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))
Пример #5
0
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)
Пример #6
0
 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))
Пример #7
0
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
Пример #8
0
 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 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
Пример #10
0
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)
Пример #11
0
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)
Пример #12
0
 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())
Пример #13
0
 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())
Пример #14
0
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())
Пример #15
0
 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()))
Пример #16
0
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)
Пример #17
0
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)
Пример #18
0
 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()))
Пример #19
0
 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()))
Пример #20
0
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
Пример #21
0
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
Пример #22
0
def test_regresssion_917258():
    try:
        bts.get_bug_log(541147)
    except Exception:
        pytest.fail()
Пример #23
0
def test_regresssion_917165():
    try:
        bts.get_bug_log(887978)
    except Exception:
        pytest.fail()
Пример #24
0
 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)
Пример #25
0
def test_regression_588954():
    """Get_bug_log must convert the body correctly to unicode."""
    try:
        bts.get_bug_log(582010)
    except UnicodeDecodeError:
        pytest.fail()
Пример #26
0
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
Пример #27
0
 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)
Пример #28
0
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
Пример #29
0
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
Пример #30
0
def test_regresssion_917165():
    bts.get_bug_log(887978)
Пример #31
0
def test_regression_588954():
    """Get_bug_log must convert the body correctly to unicode."""
    bts.get_bug_log(582010)
Пример #32
0
 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.')
Пример #33
0
def test_regresssion_917258():
    bts.get_bug_log(541147)
Пример #34
0
 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()
Пример #35
0
 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)
Пример #36
0
 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.')
Пример #37
0
def test_regression_590725():
    """bug.body utf sometimes contains invalid continuation bytes."""
    bts.get_bug_log(578363)
    bts.get_bug_log(570825)
Пример #38
0
 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)
Пример #39
0
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")
Пример #40
0
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