def test_thread_unsubscribe(self):
        request = self.request_factory.post('/')
        request = patch_message_middleware(request)
        request.user = self.user1
        group = mommy.make('groups.Group')
        self.user1.add_to_group(group.pk)

        thread = mommy.make(Thread, group=group)
        mommy.make(Message, thread=thread, sender=self.user1)

        self.assertTrue(UserThread.objects.filter(
            user=self.user1, thread=thread, subscribed_email=True).exists())

        views.thread_unsubscribe_view(request, thread.pk)

        self.assertFalse(UserThread.objects.filter(
            user=self.user1, thread=thread, subscribed_email=True).exists())
View should unsubscribe a user from a thread
dataset/ETHPy150Open ofa/connect/open_connect/connectmessages/tests/test_views.py/ThreadUnsubscribeViewTest.test_thread_unsubscribe