def test_with_user(self):
        # Create a new thread and message
        thread = mommy.make('connectmessages.Thread', group=self.group)
        message = mommy.make(
            'connectmessages.Message',
            thread=thread,
            sender=self.normal_user,
            status='approved'
        )

        # 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('admin_gallery'))
        self.assertEqual(result.status_code, 200)
        self.assertIn(image1, result.context['images'])
Returns
dataset/ETHPy150Open ofa/connect/open_connect/media/tests/test_models.py/ImagePopularityManagerTest.test_with_user--crossover with--dataset/ETHPy150Open muricoca/crab/scikits/crab/models/classes.py/MatrixBooleanPrefDataModel.preference_values_from_user