def test_send_system_message_user_pk(self):
        user = mommy.make(User)

        # pylint: disable=line-too-long
        with patch('open_connect.connectmessages.tasks.send_immediate_notification') as mock:
            tasks.send_system_message(user.pk, self.subject, self.message)

        self.assertTrue(UserThread.objects.filter(
            user=user,
            thread__first_message__sender__email='systemuser-email@connect.local',
            thread__subject=self.subject,
            thread__thread_type='direct',
            thread__closed=True
            ).exists())

        notification = Notification.objects.get(recipient=user)
        mock.delay.assert_called_once_with(notification.pk)
Test sending a system message by passing in a user's primary key
dataset/ETHPy150Open ofa/connect/open_connect/connectmessages/tests/test_tasks.py/SendSystemMessageTest.test_send_system_message_user_pk