summaryrefslogtreecommitdiff
path: root/tests/syndication_tests
diff options
context:
space:
mode:
authorViktor Garske <git@v-gar.de>2020-07-23 16:42:25 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-07-30 07:36:27 +0200
commit1173db4a16bb2938ba62a6cd50372a76a7f9e05f (patch)
tree69f95aef9fbd7875f16238ba7ae0e62c3a0057aa /tests/syndication_tests
parent184a6eebb0ef56d5f1b1315a8e666830e37f3f81 (diff)
downloaddjango-1173db4a16bb2938ba62a6cd50372a76a7f9e05f.tar.gz
Fixed #31822 -- Added support for comments URL per feed item.
The item_comments hook returns a comments URL which is then used by the feed builder.
Diffstat (limited to 'tests/syndication_tests')
-rw-r--r--tests/syndication_tests/feeds.py3
-rw-r--r--tests/syndication_tests/tests.py12
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/syndication_tests/feeds.py b/tests/syndication_tests/feeds.py
index 4e9b1170b1..adc3b2e56c 100644
--- a/tests/syndication_tests/feeds.py
+++ b/tests/syndication_tests/feeds.py
@@ -29,6 +29,9 @@ class TestRss2Feed(views.Feed):
def item_updateddate(self, item):
return item.updated
+ def item_comments(self, item):
+ return "%scomments" % item.get_absolute_url()
+
item_author_name = 'Sally Smith'
item_author_email = 'test@example.com'
item_author_link = 'http://www.example.com/'
diff --git a/tests/syndication_tests/tests.py b/tests/syndication_tests/tests.py
index dab7ebab33..d9456ed618 100644
--- a/tests/syndication_tests/tests.py
+++ b/tests/syndication_tests/tests.py
@@ -136,10 +136,20 @@ class SyndicationFeedTest(FeedTestCase):
'guid': 'http://example.com/blog/1/',
'pubDate': pub_date,
'author': 'test@example.com (Sally Smith)',
+ 'comments': '/blog/1/comments',
})
self.assertCategories(items[0], ['python', 'testing'])
for item in items:
- self.assertChildNodes(item, ['title', 'link', 'description', 'guid', 'category', 'pubDate', 'author'])
+ self.assertChildNodes(item, [
+ 'title',
+ 'link',
+ 'description',
+ 'guid',
+ 'category',
+ 'pubDate',
+ 'author',
+ 'comments',
+ ])
# Assert that <guid> does not have any 'isPermaLink' attribute
self.assertIsNone(item.getElementsByTagName(
'guid')[0].attributes.get('isPermaLink'))