diff --git a/tests/test_admin.py b/tests/test_admin.py index 4b5adfd3..b7c3a14c 100644 --- a/tests/test_admin.py +++ b/tests/test_admin.py @@ -1,3 +1,4 @@ +import sys from unittest import mock @@ -125,6 +126,13 @@ def test_send_bulk_messages_action_fail(self): self.assertEqual(message.token, "abc") self.assertEqual(message.android.notification.body, "Test bulk notification") + # 3.6 adds a `,` to the string representation of the exception + python_version = sys.version_info[:2] + if python_version >= (3, 7): + error_message = "Some messages could not be processed: UnregisteredError('error')" + else: + error_message = "Some messages could not be processed: UnregisteredError('error',)" + admin.message_user.assert_called_once_with( - request, "Some messages could not be processed: UnregisteredError('error')", level=messages.ERROR + request, error_message, level=messages.ERROR )