def test_no_images_from_banned_users(self):
        banned_user = mommy.make('accounts.User', is_banned=True)
        group = mommy.make(Group)
        banned_user.add_to_group(group.pk)
        self.user2.add_to_group(group.pk)

        # Create a new thread and message
        thread = mommy.make('connectmessages.Thread', group=group)
        message = mommy.make(
            'connectmessages.Message', thread=thread, sender=banned_user)

        # Create and attach a new image
        image1 = Image()
        image1.user = message.sender
        image1.image = File(open(self.smallfile))
        image1.save()
        message.images.add(image1)

        result = self.client.get(
            reverse('group_images', kwargs={'group_id': group.pk}))
        self.assertNotIn(image1, result.context['images'])
This is automatically called right before the response is started
dataset/ETHPy150Open ofa/connect/open_connect/groups/tests/test_views.py/GroupImagesViewTest.test_no_images_from_banned_users--crossover with--dataset/ETHPy150Open Eforcers/gae-flask-todo/lib/werkzeug/wrappers.py/BaseResponse.get_wsgi_headers