'Tests that, when the middleware is disabled, an exception is raised
when one attempts to store a message.'

@override_settings(INSTALLED_APPS=filter((lambda app: (app != 'django.contrib.messages')), settings.INSTALLED_APPS), MIDDLEWARE_CLASSES=filter((lambda m: ('MessageMiddleware' not in m)), settings.MIDDLEWARE_CLASSES), TEMPLATE_CONTEXT_PROCESSORS=filter((lambda p: ('context_processors.messages' not in p)), settings.TEMPLATE_CONTEXT_PROCESSORS), MESSAGE_LEVEL=constants.DEBUG)
def test_middleware_disabled(self):

    data = {'messages': [('Test    message    %d' % x) for x in range(5)]}
    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,))
        self.assertRaises(MessageFailure, self.client.post, add_url, data, follow=True)
