1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 14:00:00 +00:00

tests: add tests for XML char replacement

This commit is contained in:
Nicolas F 2019-02-25 12:23:02 +01:00
parent 95238ce835
commit f33dd07254

View file

@ -37,6 +37,16 @@ class TestBackend(unittest.TestCase):
self.assertTrue(backend._replace_utf8_values(test_dict)) self.assertTrue(backend._replace_utf8_values(test_dict))
self.assertDictEqual(test_dict, expected_dict) self.assertDictEqual(test_dict, expected_dict)
def test_replace_invalid_xml_chars(self):
self.assertEqual(backend.sanitize_string('ayy\x08lmao'), 'ayy\uFFFDlmao')
self.assertEqual(backend.sanitize_string('ayy\x0clmao'), 'ayy\uFFFDlmao')
self.assertEqual(backend.sanitize_string('ayy\uD8FFlmao'), 'ayy\uFFFDlmao')
self.assertEqual(backend.sanitize_string('ayy\uFFFElmao'), 'ayy\uFFFDlmao')
self.assertEqual(backend.sanitize_string('\x08ayy\x0clmao'), '\uFFFDayy\uFFFDlmao')
self.assertEqual(backend.sanitize_string('ayy\x08\x0clmao'), 'ayy\uFFFD\uFFFDlmao')
self.assertEqual(backend.sanitize_string('ayy\x08\x08lmao'), 'ayy\uFFFD\uFFFDlmao')
self.assertEqual(backend.sanitize_string('ぼくのぴこ'), 'ぼくのぴこ')
@unittest.skip('Not yet implemented') @unittest.skip('Not yet implemented')
def test_handle_torrent_upload(self): def test_handle_torrent_upload(self):
pass pass