def test_updates_count(self):
        user = self.create_user()
        thread = self.create_thread(sender=user)

        original_count = thread.message_set.count()

        for _ in range(0, 5):
            msg = mommy.make(Message, thread=thread, sender=user)

        send_message(msg.pk)

        # Because django caches querysets, we need to request the thread again
        refreshed_thread = Thread.objects.get(pk=msg.thread.pk)

        self.assertEqual(refreshed_thread.total_messages, original_count + 5)
Test that sending a message updates the message count.
dataset/ETHPy150Open ofa/connect/open_connect/connectmessages/tests/test_tasks.py/SendGroupMessageTest.test_updates_count