mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
test_mattermost_importer: Condition html2text crash on Python version.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
Tim Abbott
parent
fd1543a67c
commit
e216317f88
@@ -457,7 +457,7 @@ def process_raw_message_batch(
|
||||
|
||||
try:
|
||||
content = convert_html_to_text(content)
|
||||
except Exception:
|
||||
except Exception: # nocoverage
|
||||
logging.warning("Error converting HTML to text for message: '%s'; continuing", content)
|
||||
logging.warning(str(raw_message))
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import filecmp
|
||||
import os
|
||||
import sys
|
||||
from typing import Any
|
||||
from unittest.mock import call, patch
|
||||
|
||||
@@ -705,9 +706,15 @@ class MatterMostImporter(ZulipTestCase):
|
||||
warn_log.output,
|
||||
[
|
||||
"WARNING:root:Skipping importing direct message groups and DMs since there are multiple teams in the export",
|
||||
# Check error log when trying to process a message with faulty HTML.
|
||||
"WARNING:root:Error converting HTML to text for message: 'This will crash html2text!!! <g:brand><![CDATSALOMON NORTH AMERICA, IN}}]]></g:brand>'; continuing",
|
||||
"WARNING:root:{'sender_id': 2, 'content': 'This will crash html2text!!! <g:brand><![CDATSALOMON NORTH AMERICA, IN}}]]></g:brand>', 'date_sent': 1553166657, 'reactions': [], 'channel_name': 'dumbledores-army'}",
|
||||
*(
|
||||
[
|
||||
# Check error log when trying to process a message with faulty HTML.
|
||||
"WARNING:root:Error converting HTML to text for message: 'This will crash html2text!!! <g:brand><![CDATSALOMON NORTH AMERICA, IN}}]]></g:brand>'; continuing",
|
||||
"WARNING:root:{'sender_id': 2, 'content': 'This will crash html2text!!! <g:brand><![CDATSALOMON NORTH AMERICA, IN}}]]></g:brand>', 'date_sent': 1553166657, 'reactions': [], 'channel_name': 'dumbledores-army'}",
|
||||
]
|
||||
if sys.version_info < (3, 13)
|
||||
else []
|
||||
),
|
||||
"WARNING:root:Skipping importing direct message groups and DMs since there are multiple teams in the export",
|
||||
],
|
||||
)
|
||||
@@ -955,8 +962,14 @@ class MatterMostImporter(ZulipTestCase):
|
||||
warn_log.output,
|
||||
[
|
||||
"WARNING:root:Skipping importing direct message groups and DMs since there are multiple teams in the export",
|
||||
"WARNING:root:Error converting HTML to text for message: 'Xxxx xxxx xxxxx xxxx2xxxx!!! <x:xxxxx><![XXXXXXXXXXX XXXXX XXXXXXX, XX}}]]></x:xxxxx>'; continuing",
|
||||
"WARNING:root:{'sender_id': 2, 'content': 'Xxxx xxxx xxxxx xxxx2xxxx!!! <x:xxxxx><![XXXXXXXXXXX XXXXX XXXXXXX, XX}}]]></x:xxxxx>', 'date_sent': 1553166657, 'reactions': [], 'channel_name': 'dumbledores-army'}",
|
||||
*(
|
||||
[
|
||||
"WARNING:root:Error converting HTML to text for message: 'Xxxx xxxx xxxxx xxxx2xxxx!!! <x:xxxxx><![XXXXXXXXXXX XXXXX XXXXXXX, XX}}]]></x:xxxxx>'; continuing",
|
||||
"WARNING:root:{'sender_id': 2, 'content': 'Xxxx xxxx xxxxx xxxx2xxxx!!! <x:xxxxx><![XXXXXXXXXXX XXXXX XXXXXXX, XX}}]]></x:xxxxx>', 'date_sent': 1553166657, 'reactions': [], 'channel_name': 'dumbledores-army'}",
|
||||
]
|
||||
if sys.version_info < (3, 13)
|
||||
else []
|
||||
),
|
||||
"WARNING:root:Skipping importing direct message groups and DMs since there are multiple teams in the export",
|
||||
],
|
||||
)
|
||||
@@ -984,8 +997,14 @@ class MatterMostImporter(ZulipTestCase):
|
||||
warn_log.output,
|
||||
[
|
||||
"WARNING:root:Skipping importing direct message groups and DMs since there are multiple teams in the export",
|
||||
"WARNING:root:Error converting HTML to text for message: 'Xxxx xxxx xxxxx xxxx2xxxx!!! <x:xxxxx><![XXXXXXXXXXX XXXXX XXXXXXX, XX}}]]></x:xxxxx>'; continuing",
|
||||
"WARNING:root:{'sender_id': 2, 'content': 'Xxxx xxxx xxxxx xxxx2xxxx!!! <x:xxxxx><![XXXXXXXXXXX XXXXX XXXXXXX, XX}}]]></x:xxxxx>', 'date_sent': 1553166657, 'reactions': [], 'channel_name': 'dumbledores-army'}",
|
||||
*(
|
||||
[
|
||||
"WARNING:root:Error converting HTML to text for message: 'Xxxx xxxx xxxxx xxxx2xxxx!!! <x:xxxxx><![XXXXXXXXXXX XXXXX XXXXXXX, XX}}]]></x:xxxxx>'; continuing",
|
||||
"WARNING:root:{'sender_id': 2, 'content': 'Xxxx xxxx xxxxx xxxx2xxxx!!! <x:xxxxx><![XXXXXXXXXXX XXXXX XXXXXXX, XX}}]]></x:xxxxx>', 'date_sent': 1553166657, 'reactions': [], 'channel_name': 'dumbledores-army'}",
|
||||
]
|
||||
if sys.version_info < (3, 13)
|
||||
else []
|
||||
),
|
||||
"WARNING:root:Skipping importing direct message groups and DMs since there are multiple teams in the export",
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user