def test_middleware_disabled_anon_user_fail_silently(self):
        settings.MESSAGE_LEVEL = constants.DEBUG
        settings.INSTALLED_APPS = list(settings.INSTALLED_APPS)
        settings.INSTALLED_APPS.remove(
            'django.contrib.messages',
        )
        settings.MIDDLEWARE_CLASSES = list(settings.MIDDLEWARE_CLASSES)
        settings.MIDDLEWARE_CLASSES.remove(
            'django.contrib.messages.middleware.MessageMiddleware',
        )
        settings.TEMPLATE_CONTEXT_PROCESSORS = \
          list(settings.TEMPLATE_CONTEXT_PROCESSORS)
        settings.TEMPLATE_CONTEXT_PROCESSORS.remove(
            'django.contrib.messages.context_processors.messages',
        )
        data = {
            'messages': ['Test message %d' % x for x in xrange(10)],
            'fail_silently': True,
        }
        show_url = reverse('django.contrib.messages.tests.urls.show')
        for level in ('debug', 'info', 'success', 'warning', 'error'):
            add_url = reverse('django.contrib.messages.tests.urls.add',
                              args=(level,))
            response = self.client.post(add_url, data, follow=True)
            self.assertRedirects(response, show_url)
            self.assertTrue('messages' in response.context)
            self.assertEqual(list(response.context['messages']), [])
Returns the serialized version of the object if it has to_json() defined
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/contrib/messages/tests/base.py/BaseTest.test_middleware_disabled_anon_user_fail_silently--crossover with--dataset/ETHPy150Open ucb-sts/sts/sts/util/convenience.py/get_json_attr