Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed comment_test tests under hash randomization.

Thanks clelland for the patch.
  • Loading branch information...
commit 789ea3342d5cdfc850a2f68818e707cdc5111bb9 1 parent 46d27a6
Aymeric Augustin authored October 26, 2012
23  tests/regressiontests/comment_tests/tests/feed_tests.py
... ...
@@ -1,5 +1,7 @@
1 1
 from __future__ import absolute_import
2 2
 
  3
+from xml.etree import ElementTree as ET
  4
+
3 5
 from django.conf import settings
4 6
 from django.contrib.comments.models import Comment
5 7
 from django.contrib.contenttypes.models import ContentType
@@ -31,8 +33,21 @@ def test_feed(self):
31 33
         response = self.client.get(self.feed_url)
32 34
         self.assertEqual(response.status_code, 200)
33 35
         self.assertEqual(response['Content-Type'], 'application/rss+xml; charset=utf-8')
34  
-        self.assertContains(response, '<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">')
35  
-        self.assertContains(response, '<title>example.com comments</title>')
36  
-        self.assertContains(response, '<link>http://example.com/</link>')
37  
-        self.assertContains(response, '</rss>')
  36
+
  37
+        rss_elem = ET.fromstring(response.content)
  38
+
  39
+        self.assertEqual(rss_elem.tag, "rss")
  40
+        self.assertEqual(rss_elem.attrib, {"version": "2.0"})
  41
+
  42
+        channel_elem = rss_elem.find("channel")
  43
+
  44
+        title_elem = channel_elem.find("title")
  45
+        self.assertEqual(title_elem.text, "example.com comments")
  46
+
  47
+        link_elem = channel_elem.find("link")
  48
+        self.assertEqual(link_elem.text, "http://example.com/")
  49
+
  50
+        atomlink_elem = channel_elem.find("{http://www.w3.org/2005/Atom}link")
  51
+        self.assertEqual(atomlink_elem.attrib, {"href": "http://example.com/rss/comments/", "rel": "self"})
  52
+
38 53
         self.assertNotContains(response, "A comment for the second site.")

0 notes on commit 789ea33

Please sign in to comment.
Something went wrong with that request. Please try again.