django1/django/contrib/messages/tests/test_mixins.py

16 lines
578 B
Python
Raw Normal View History

from django.test import TestCase
from django.contrib.messages.tests.urls import ContactFormViewWithMsg
from django.core.urlresolvers import reverse
2013-11-03 04:12:09 +08:00
class SuccessMessageMixinTests(TestCase):
urls = 'django.contrib.messages.tests.urls'
def test_set_messages_success(self):
author = {'name': 'John Doe',
'slug': 'success-msg'}
add_url = reverse('add_success_msg')
req = self.client.post(add_url, author)
self.assertIn(ContactFormViewWithMsg.success_message % author,
req.cookies['messages'].value)