From f97f09b80ffb437d3bab44b44124708fc5738555db3dc7bd389178ade74b403d Mon Sep 17 00:00:00 2001 From: Petr Gajdos Date: Thu, 14 Nov 2019 17:59:39 +0000 Subject: [PATCH] - fix testsuite - added patches https://gitlab.com/mailman/mailman-hyperkitty/commit/84e05811fb71aa105fd85fd14399bff813ed744d + python-mailman-hyperkitty-reflect-changes-in-mailman-core.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:mailman/python-mailman-hyperkitty?expand=0&rev=3 --- ...itty-reflect-changes-in-mailman-core.patch | 45 +++++++++++++++++++ python-mailman-hyperkitty.changes | 8 ++++ python-mailman-hyperkitty.spec | 3 ++ 3 files changed, 56 insertions(+) create mode 100644 python-mailman-hyperkitty-reflect-changes-in-mailman-core.patch diff --git a/python-mailman-hyperkitty-reflect-changes-in-mailman-core.patch b/python-mailman-hyperkitty-reflect-changes-in-mailman-core.patch new file mode 100644 index 0000000..a3175b0 --- /dev/null +++ b/python-mailman-hyperkitty-reflect-changes-in-mailman-core.patch @@ -0,0 +1,45 @@ +diff --git a/mailman_hyperkitty/tests/test_archiver.py b/mailman_hyperkitty/tests/test_archiver.py +index 3d8896b6bb80eb3fe0b3aaa78c1eb3ac67076c5d..8430e3e3c0a943021707a2a34b4c700eb0a9a053 100644 +--- a/mailman_hyperkitty/tests/test_archiver.py ++++ b/mailman_hyperkitty/tests/test_archiver.py +@@ -102,10 +102,10 @@ class ArchiverTestCase(TestCase): + self.requests_patcher = patch("mailman_hyperkitty.requests") + self.requests = self.requests_patcher.start() + self.fake_response = None +- self.requests.get.side_effect = \ +- lambda url, *a, **kw: self.fake_response +- self.requests.post.side_effect = \ +- lambda url, *a, **kw: self.fake_response ++ self.requests.get.side_effect = ( ++ lambda url, *a, **kw: self.fake_response) ++ self.requests.post.side_effect = ( ++ lambda url, *a, **kw: self.fake_response) + + def tearDown(self): + self.requests_patcher.stop() +@@ -345,19 +345,14 @@ class ArchiverTestCase(TestCase): + self.archiver._switchboard.queue_directory)), 1) + self.assertEqual(len(self.archiver._switchboard.files), 1) + +- def test_archive_message_unserializable(self): ++ def test_archive_message_unserializable_raises_no_errors(self): ++ self.fake_response = FakeResponse(200, {"url": "dummy"}) + msg = self._get_msg() + msg["content-type"] = 'text/plain; charset="UTF-8"' + msg.set_payload(b"this contains encoded unicode \xc3\xa9 \xc3\xa0") +- # If you try to serialize this message to text, it will cause a: +- # KeyError: 'content-transfer-encoding' ++ # If you try to serialize this message to text, Mailman should be able ++ # to prevent KeyError by ignoring the bad-characters. + with patch("mailman_hyperkitty.logger") as logger: + self.archiver.archive_message(self.mlist, msg) +- # Check error log +- self.assertEqual(logger.error.call_count, 1) +- self.assertTrue(isinstance( +- logger.error.call_args_list[0][0][2], KeyError)) +- # Check that the message is not stored in the spool. +- self.assertEqual(len(os.listdir( +- self.archiver._switchboard.queue_directory)), 0) +- self.assertEqual(len(self.archiver._switchboard.files), 0) ++ # Check no errors in the log. ++ self.assertEqual(logger.error.call_count, 0) diff --git a/python-mailman-hyperkitty.changes b/python-mailman-hyperkitty.changes index a2ad869..91b9544 100644 --- a/python-mailman-hyperkitty.changes +++ b/python-mailman-hyperkitty.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Nov 14 17:58:56 UTC 2019 - pgajdos@suse.com + +- fix testsuite +- added patches + https://gitlab.com/mailman/mailman-hyperkitty/commit/84e05811fb71aa105fd85fd14399bff813ed744d + + python-mailman-hyperkitty-reflect-changes-in-mailman-core.patch + ------------------------------------------------------------------- Thu Nov 14 12:36:41 UTC 2019 - Tomáš Chvátal diff --git a/python-mailman-hyperkitty.spec b/python-mailman-hyperkitty.spec index eb7e355..e3fec8e 100644 --- a/python-mailman-hyperkitty.spec +++ b/python-mailman-hyperkitty.spec @@ -25,6 +25,8 @@ Summary: Mailman archiver plugin for HyperKitty License: GPL-3.0-only URL: https://gitlab.com/mailman/mailman-hyperkitty/ Source: https://files.pythonhosted.org/packages/source/m/mailman-hyperkitty/mailman-hyperkitty-%{version}.tar.gz +# https://gitlab.com/mailman/mailman-hyperkitty/commit/84e05811fb71aa105fd85fd14399bff813ed744d +Patch0: python-mailman-hyperkitty-reflect-changes-in-mailman-core.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -48,6 +50,7 @@ Mailman archiver plugin for HyperKitty %prep %setup -q -n mailman-hyperkitty-%{version} +%patch0 -p1 %build %python_build