def test_notify_a_set_of_users(self):
        users = UserFactory.create_batch(3)
        subj = "Hello everyone!"
        body = "This is the notification body."

        services.notify_users(User.objects.all(), subj, body=body)
        for user in users:
            user_notification = Notification.objects.get(recipient=user)
            self.assertEqual(user_notification.subject, subj)
            self.assertEqual(user_notification.body, body)
Example #2
0
    def test_notify_a_set_of_users(self):
        users = UserFactory.create_batch(3)
        subj = "Hello everyone!"
        body = "This is the notification body."

        Dispatcher().notify_users(User.objects.all(), subj, body=body)
        for user in users:
            user_notification = Notification.objects.get(recipient=user)
            assert user_notification.subject == subj
            assert user_notification.body == body