'Tests that messages persist properly when multiple POSTs are made
before a GET.'

def test_multiple_posts(self):

    settings.MESSAGE_LEVEL = constants.DEBUG
    data = {'messages': [('Test    message    %d' % x) for x in xrange(10)]}
    show_url = reverse('django.contrib.messages.tests.urls.show')
    messages = []
    for level in ('debug', 'info', 'success', 'warning', 'error'):
        messages.extend([Message(self.levels[level], msg) for msg in data['messages']])
        add_url = reverse('django.contrib.messages.tests.urls.add', args=(level,))
        self.client.post(add_url, data)
    response = self.client.get(show_url)
    self.assertTrue(('messages' in response.context))
    self.assertEqual(list(response.context['messages']), messages)
    for msg in data['messages']:
        self.assertContains(response, msg)
