From 8e199e063f9e20b2cbf3a7d3afdfae1e43a88416 Mon Sep 17 00:00:00 2001 From: nitely Date: Tue, 3 Mar 2020 09:28:28 -0300 Subject: [PATCH] fix compat --- spirit/comment/tests.py | 7 ++++--- spirit/core/tests/tests_utils.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/spirit/comment/tests.py b/spirit/comment/tests.py index 0db901deb..8a92e412c 100644 --- a/spirit/comment/tests.py +++ b/spirit/comment/tests.py @@ -554,9 +554,10 @@ def test_comment_image_upload_unique_no_name(self): HTTP_X_REQUESTED_WITH='XMLHttpRequest', data={'image': file}) res = json.loads(response.content.decode('utf-8')) - self.assertIn( - 'File extension “” is not allowed', - res['error']['image'][0]) + # django 2.2 and 3.0 compat + self.assertTrue( + 'File extension “” is not allowed' in res['error']['image'][0] + or 'File extension \'\' is not allowed' in res['error']['image'][0]) @override_settings(MEDIA_ROOT=os.path.join(settings.BASE_DIR, 'media_test')) def test_comment_image_upload_unique_bad_name(self): diff --git a/spirit/core/tests/tests_utils.py b/spirit/core/tests/tests_utils.py index 18507d2cf..1a0b777cc 100644 --- a/spirit/core/tests/tests_utils.py +++ b/spirit/core/tests/tests_utils.py @@ -160,7 +160,10 @@ def render(date): self.assertEqual(render(now - datetime.timedelta(minutes=1)), "1m") self.assertEqual(render(now - datetime.timedelta(hours=1)), "1h") self.assertEqual(render(now - datetime.timedelta(days=1)), "8 Mar") - self.assertEqual(render(now - datetime.timedelta(days=69)), "31 Dec '11") + # django 2.2 and 3.0 compat + self.assertTrue( + render(now - datetime.timedelta(days=69)) == "31 Dec '11" + or render(now - datetime.timedelta(days=69)) == "31 Dec '11") # Tests it uses localtime # This is 2012-03-08HT19:30:00-06:00 in America/Chicago @@ -171,7 +174,10 @@ def render(date): timezone.deactivate() with override_settings(TIME_ZONE="America/Chicago"): - self.assertEqual(render(dt), "8 Mar '11") + # django 2.2 and 3.0 compat + self.assertTrue( + render(dt) == "8 Mar '11" + or render(dt) == "8 Mar '11") finally: ttags_utils.datetime = orig_humanize_datetime