Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorwurstsalat <mailtrash@posteo.de>2022-12-10 00:10:14 +0300
committerwurstsalat <mailtrash@posteo.de>2022-12-10 00:10:57 +0300
commit6b9cb54872e7fc0519e896bedea5a96386d4ee08 (patch)
tree5a53f6807f0ac62ede1de7a8f59999153e7f0153 /test
parent38ed76210f509541ba970e51bed28d1dc5892941 (diff)
cq: Move remove_invalid_xml_chars method and add test
Diffstat (limited to 'test')
-rw-r--r--test/no_gui/test_text_helpers.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/no_gui/test_text_helpers.py b/test/no_gui/test_text_helpers.py
index c71b8ee8e..bdff8f317 100644
--- a/test/no_gui/test_text_helpers.py
+++ b/test/no_gui/test_text_helpers.py
@@ -3,9 +3,23 @@ import unittest
from gajim.common.text_helpers import escape_iri_path_segment
from gajim.common.text_helpers import jid_to_iri
from gajim.common.text_helpers import format_duration
+from gajim.common.text_helpers import remove_invalid_xml_chars
class Test(unittest.TestCase):
+
+ def test_remove_invalid_xml_chars(self) -> None:
+ invalid_chars = [
+ '\x0b',
+ '\udfff',
+ '\x08'
+ ]
+ for char in invalid_chars:
+ self.assertEqual(remove_invalid_xml_chars(char), '')
+
+ self.assertEqual(remove_invalid_xml_chars(''), '')
+ self.assertEqual(remove_invalid_xml_chars('ä'), 'ä')
+
def test_escape_iri_path_segment(self):
self.assertEqual(escape_iri_path_segment(''), '', '<empty string>')