PageRenderTime 102ms CodeModel.GetById 96ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/regressiontests/comment_tests/tests/feed_tests.py

https://code.google.com/p/mango-py/
Python | 33 lines | 24 code | 9 blank | 0 comment | 0 complexity | f27ba1d179db24a2d354502609babaea MD5 | raw file
 1import warnings
 2
 3from django.test.utils import get_warnings_state, restore_warnings_state
 4
 5from regressiontests.comment_tests.tests import CommentTestCase
 6
 7
 8class CommentFeedTests(CommentTestCase):
 9    urls = 'regressiontests.comment_tests.urls'
10    feed_url = '/rss/comments/'
11
12    def test_feed(self):
13        response = self.client.get(self.feed_url)
14        self.assertEqual(response.status_code, 200)
15        self.assertEqual(response['Content-Type'], 'application/rss+xml')
16        self.assertContains(response, '<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">')
17        self.assertContains(response, '<title>example.com comments</title>')
18        self.assertContains(response, '<link>http://example.com/</link>')
19        self.assertContains(response, '</rss>')
20
21
22class LegacyCommentFeedTests(CommentFeedTests):
23    feed_url = '/rss/legacy/comments/'
24
25    def setUp(self):
26        self._warnings_state = get_warnings_state()
27        warnings.filterwarnings("ignore", category=DeprecationWarning,
28                                module='django.contrib.syndication.views')
29        warnings.filterwarnings("ignore", category=DeprecationWarning,
30                                module='django.contrib.syndication.feeds')
31
32    def tearDown(self):
33        restore_warnings_state(self._warnings_state)