Skip to content

Commit

Permalink
fixes admin test for python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Jahn committed Jan 28, 2024
1 parent 056ebf6 commit a8bfcd5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/test_admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from unittest import mock


Expand Down Expand Up @@ -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
)

0 comments on commit a8bfcd5

Please sign in to comment.