2021-07-01 13:55:39 +02:00
|
|
|
from zerver.lib.mention import MentionData
|
|
|
|
from zerver.lib.notification_data import get_user_group_mentions_data
|
2021-06-15 14:30:51 +02:00
|
|
|
from zerver.lib.test_classes import ZulipTestCase
|
2021-07-01 13:55:39 +02:00
|
|
|
from zerver.lib.user_groups import create_user_group
|
2021-06-15 14:30:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
class TestNotificationData(ZulipTestCase):
|
|
|
|
def test_is_push_notifiable(self) -> None:
|
2021-06-23 10:44:34 +02:00
|
|
|
user_id = self.example_user("hamlet").id
|
2021-06-25 13:58:53 +02:00
|
|
|
acting_user_id = self.example_user("cordelia").id
|
2021-06-15 14:30:51 +02:00
|
|
|
|
|
|
|
# Boring case
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(user_id=user_id)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_push_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
None,
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertFalse(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_push_notifiable(
|
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
2021-06-24 15:44:42 +02:00
|
|
|
# Private message
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(user_id=user_id)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_push_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
"private_message",
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertTrue(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_push_notifiable(
|
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
2021-06-24 15:44:42 +02:00
|
|
|
# Mention
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(
|
|
|
|
user_id=user_id, flags=["mentioned"], mentioned=True
|
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_push_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
"mentioned",
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertTrue(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_push_notifiable(
|
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
2021-06-24 15:44:42 +02:00
|
|
|
# Wildcard mention
|
2021-06-15 14:30:51 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(
|
2021-06-23 10:44:34 +02:00
|
|
|
user_id=user_id, flags=["wildcard_mentioned"], wildcard_mention_notify=True
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_push_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
"wildcard_mentioned",
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertTrue(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_push_notifiable(
|
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
2021-06-24 15:44:42 +02:00
|
|
|
# Stream notification
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(
|
|
|
|
user_id=user_id, stream_push_notify=True
|
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_push_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
"stream_push_notify",
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertTrue(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_push_notifiable(
|
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# Now, test the `online_push_enabled` property
|
|
|
|
# Test no notifications when not idle
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(user_id=user_id)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_push_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=False
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
None,
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertFalse(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_push_notifiable(
|
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=False
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# Test notifications are sent when not idle but `online_push_enabled = True`
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(
|
|
|
|
user_id=user_id, online_push_enabled=True
|
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_push_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=False
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
"private_message",
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertTrue(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_push_notifiable(
|
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=False
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# The following are hypothetical cases, since a private message can never have `stream_push_notify = True`.
|
|
|
|
# We just want to test the early (False) return patterns in these special cases:
|
|
|
|
# Message sender is muted.
|
|
|
|
user_data = self.create_user_notifications_data_object(
|
2021-06-23 10:44:34 +02:00
|
|
|
user_id=user_id,
|
2021-06-15 14:30:51 +02:00
|
|
|
sender_is_muted=True,
|
|
|
|
flags=["mentioned", "wildcard_mentioned"],
|
|
|
|
wildcard_mention_notify=True,
|
|
|
|
mentioned=True,
|
|
|
|
stream_email_notify=True,
|
|
|
|
stream_push_notify=True,
|
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_push_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
None,
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertFalse(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_push_notifiable(
|
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# Message sender is the user the object corresponds to.
|
|
|
|
user_data = self.create_user_notifications_data_object(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_id=acting_user_id,
|
2021-06-15 14:30:51 +02:00
|
|
|
sender_is_muted=False,
|
|
|
|
flags=["mentioned", "wildcard_mentioned"],
|
|
|
|
wildcard_mention_notify=True,
|
|
|
|
mentioned=True,
|
|
|
|
stream_email_notify=True,
|
|
|
|
stream_push_notify=True,
|
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_push_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
None,
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertFalse(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_push_notifiable(
|
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
def test_is_email_notifiable(self) -> None:
|
2021-06-23 10:44:34 +02:00
|
|
|
user_id = self.example_user("hamlet").id
|
2021-06-25 13:58:53 +02:00
|
|
|
acting_user_id = self.example_user("cordelia").id
|
2021-06-15 14:30:51 +02:00
|
|
|
|
|
|
|
# Boring case
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(user_id=user_id)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_email_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
None,
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertFalse(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_email_notifiable(
|
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
2021-06-24 15:44:42 +02:00
|
|
|
# Private message
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(user_id=user_id)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_email_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
"private_message",
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertTrue(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_email_notifiable(
|
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
2021-06-24 15:44:42 +02:00
|
|
|
# Mention
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(
|
|
|
|
user_id=user_id, flags=["mentioned"], mentioned=True
|
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_email_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
"mentioned",
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertTrue(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_email_notifiable(
|
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
2021-06-24 15:44:42 +02:00
|
|
|
# Wildcard mention
|
2021-06-15 14:30:51 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(
|
2021-06-23 10:44:34 +02:00
|
|
|
user_id=user_id, flags=["wildcard_mentioned"], wildcard_mention_notify=True
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_email_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
"wildcard_mentioned",
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertTrue(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_email_notifiable(
|
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
2021-06-24 15:44:42 +02:00
|
|
|
# Stream notification
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(
|
|
|
|
user_id=user_id, stream_email_notify=True
|
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_email_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
"stream_email_notify",
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertTrue(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_email_notifiable(
|
|
|
|
private_message=False, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# Test no notifications when not idle
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(user_id=user_id)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_email_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=False
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
None,
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertFalse(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_email_notifiable(
|
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=False
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# The following are hypothetical cases, since a private message can never have `stream_email_notify = True`.
|
|
|
|
# We just want to test the early (False) return patterns in these special cases:
|
|
|
|
# Message sender is muted.
|
|
|
|
user_data = self.create_user_notifications_data_object(
|
2021-06-23 10:44:34 +02:00
|
|
|
user_id=user_id,
|
2021-06-15 14:30:51 +02:00
|
|
|
sender_is_muted=True,
|
|
|
|
flags=["mentioned", "wildcard_mentioned"],
|
|
|
|
wildcard_mention_notify=True,
|
|
|
|
mentioned=True,
|
|
|
|
stream_email_notify=True,
|
|
|
|
stream_push_notify=True,
|
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_email_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
None,
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertFalse(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_email_notifiable(
|
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# Message sender is the user the object corresponds to.
|
|
|
|
user_data = self.create_user_notifications_data_object(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_id=acting_user_id,
|
2021-06-15 14:30:51 +02:00
|
|
|
sender_is_muted=False,
|
|
|
|
flags=["mentioned", "wildcard_mentioned"],
|
|
|
|
wildcard_mention_notify=True,
|
|
|
|
mentioned=True,
|
|
|
|
stream_email_notify=True,
|
|
|
|
stream_push_notify=True,
|
|
|
|
)
|
2021-06-24 15:44:42 +02:00
|
|
|
self.assertEqual(
|
|
|
|
user_data.get_email_notification_trigger(
|
2021-06-25 13:58:53 +02:00
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
2021-06-24 15:44:42 +02:00
|
|
|
),
|
|
|
|
None,
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertFalse(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_email_notifiable(
|
|
|
|
private_message=True, acting_user_id=acting_user_id, idle=True
|
|
|
|
)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
def test_is_notifiable(self) -> None:
|
|
|
|
# This is just for coverage purposes. We've already tested all scenarios above,
|
|
|
|
# and `is_notifiable` is a simple OR of the email and push functions.
|
2021-06-23 10:44:34 +02:00
|
|
|
user_id = self.example_user("hamlet").id
|
2021-06-25 13:58:53 +02:00
|
|
|
acting_user_id = self.example_user("cordelia").id
|
2021-06-23 10:44:34 +02:00
|
|
|
user_data = self.create_user_notifications_data_object(user_id=user_id)
|
2021-06-15 14:30:51 +02:00
|
|
|
self.assertTrue(
|
2021-06-25 13:58:53 +02:00
|
|
|
user_data.is_notifiable(private_message=True, acting_user_id=acting_user_id, idle=True)
|
2021-06-15 14:30:51 +02:00
|
|
|
)
|
2021-07-01 13:55:39 +02:00
|
|
|
|
|
|
|
def test_user_group_mentions_map(self) -> None:
|
|
|
|
hamlet = self.example_user("hamlet")
|
|
|
|
cordelia = self.example_user("cordelia")
|
|
|
|
realm = hamlet.realm
|
|
|
|
|
|
|
|
hamlet_only = create_user_group("hamlet_only", [hamlet], realm)
|
|
|
|
hamlet_and_cordelia = create_user_group("hamlet_and_cordelia", [hamlet, cordelia], realm)
|
|
|
|
|
|
|
|
# Base case. No user/user group mentions
|
|
|
|
result = get_user_group_mentions_data(
|
|
|
|
mentioned_user_ids=set(),
|
|
|
|
mentioned_user_group_ids=[],
|
|
|
|
mention_data=MentionData(realm.id, "no group mentioned"),
|
|
|
|
)
|
|
|
|
self.assertDictEqual(result, {})
|
|
|
|
|
|
|
|
# Only user group mentions, no personal mentions
|
|
|
|
result = get_user_group_mentions_data(
|
|
|
|
mentioned_user_ids=set(),
|
|
|
|
mentioned_user_group_ids=[hamlet_and_cordelia.id],
|
|
|
|
mention_data=MentionData(realm.id, "hey @*hamlet_and_cordelia*!"),
|
|
|
|
)
|
|
|
|
self.assertDictEqual(
|
|
|
|
result,
|
|
|
|
{
|
|
|
|
hamlet.id: hamlet_and_cordelia.id,
|
|
|
|
cordelia.id: hamlet_and_cordelia.id,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
# Hamlet is mentioned in two user groups
|
|
|
|
# Test that we consider the smaller user group
|
|
|
|
result = get_user_group_mentions_data(
|
|
|
|
mentioned_user_ids=set(),
|
|
|
|
mentioned_user_group_ids=[hamlet_and_cordelia.id, hamlet_only.id],
|
|
|
|
mention_data=MentionData(realm.id, "hey @*hamlet_and_cordelia* and @*hamlet_only*"),
|
|
|
|
)
|
|
|
|
self.assertDictEqual(
|
|
|
|
result,
|
|
|
|
{
|
|
|
|
hamlet.id: hamlet_only.id,
|
|
|
|
cordelia.id: hamlet_and_cordelia.id,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
# To make sure we aren't getting the expected data from over-writing in a loop,
|
|
|
|
# test the same setup as above, but with reversed group ids.
|
|
|
|
result = get_user_group_mentions_data(
|
|
|
|
mentioned_user_ids=set(),
|
|
|
|
mentioned_user_group_ids=[hamlet_only.id, hamlet_and_cordelia.id],
|
|
|
|
mention_data=MentionData(realm.id, "hey @*hamlet_only* and @*hamlet_and_cordelia*"),
|
|
|
|
)
|
|
|
|
self.assertDictEqual(
|
|
|
|
result,
|
|
|
|
{
|
|
|
|
hamlet.id: hamlet_only.id,
|
|
|
|
cordelia.id: hamlet_and_cordelia.id,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
# Personal and user group mentioned. Test that we don't consider the user
|
|
|
|
# group mention for Hamlet in this case.
|
|
|
|
result = get_user_group_mentions_data(
|
|
|
|
mentioned_user_ids=set([hamlet.id]),
|
|
|
|
mentioned_user_group_ids=[hamlet_and_cordelia.id],
|
|
|
|
mention_data=MentionData(realm.id, "hey @*hamlet_and_cordelia*!"),
|
|
|
|
)
|
|
|
|
self.assertDictEqual(
|
|
|
|
result,
|
|
|
|
{
|
|
|
|
cordelia.id: hamlet_and_cordelia.id,
|
|
|
|
},
|
|
|
|
)
|