PageRenderTime 121ms CodeModel.GetById 1ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause
  1. import warnings
  2. from django.test.utils import get_warnings_state, restore_warnings_state
  3. from regressiontests.comment_tests.tests import CommentTestCase
  4. class CommentFeedTests(CommentTestCase):
  5. urls = 'regressiontests.comment_tests.urls'
  6. feed_url = '/rss/comments/'
  7. def test_feed(self):
  8. response = self.client.get(self.feed_url)
  9. self.assertEqual(response.status_code, 200)
  10. self.assertEqual(response['Content-Type'], 'application/rss+xml')
  11. self.assertContains(response, '<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">')
  12. self.assertContains(response, '<title>example.com comments</title>')
  13. self.assertContains(response, '<link>http://example.com/</link>')
  14. self.assertContains(response, '</rss>')
  15. class LegacyCommentFeedTests(CommentFeedTests):
  16. feed_url = '/rss/legacy/comments/'
  17. def setUp(self):
  18. self._warnings_state = get_warnings_state()
  19. warnings.filterwarnings("ignore", category=DeprecationWarning,
  20. module='django.contrib.syndication.views')
  21. warnings.filterwarnings("ignore", category=DeprecationWarning,
  22. module='django.contrib.syndication.feeds')
  23. def tearDown(self):
  24. restore_warnings_state(self._warnings_state)