mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
[4.1.x] Refs #22078 -- Added syndication test for feeds with static methods.
Backport of 7e4656e4b2189390a433a149091442d53a777e2b from main.
This commit is contained in:
parent
ae7aecc93e
commit
9d3b812001
@ -39,6 +39,12 @@ class TestRss2Feed(views.Feed):
|
|||||||
item_copyright = "Copyright (c) 2007, Sally Smith"
|
item_copyright = "Copyright (c) 2007, Sally Smith"
|
||||||
|
|
||||||
|
|
||||||
|
class TestRss2FeedWithStaticMethod(TestRss2Feed):
|
||||||
|
@staticmethod
|
||||||
|
def categories():
|
||||||
|
return ("javascript", "vue")
|
||||||
|
|
||||||
|
|
||||||
class TestRss2FeedWithGuidIsPermaLinkTrue(TestRss2Feed):
|
class TestRss2FeedWithGuidIsPermaLinkTrue(TestRss2Feed):
|
||||||
def item_guid_is_permalink(self, item):
|
def item_guid_is_permalink(self, item):
|
||||||
return True
|
return True
|
||||||
|
@ -196,6 +196,12 @@ class SyndicationFeedTest(FeedTestCase):
|
|||||||
item.getElementsByTagName("guid")[0].attributes.get("isPermaLink")
|
item.getElementsByTagName("guid")[0].attributes.get("isPermaLink")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_rss2_feed_with_static_methods(self):
|
||||||
|
response = self.client.get("/syndication/rss2/with-static-methods/")
|
||||||
|
doc = minidom.parseString(response.content)
|
||||||
|
chan = doc.getElementsByTagName("rss")[0].getElementsByTagName("channel")[0]
|
||||||
|
self.assertCategories(chan, ["javascript", "vue"])
|
||||||
|
|
||||||
def test_rss2_feed_guid_permalink_false(self):
|
def test_rss2_feed_guid_permalink_false(self):
|
||||||
"""
|
"""
|
||||||
Test if the 'isPermaLink' attribute of <guid> element of an item
|
Test if the 'isPermaLink' attribute of <guid> element of an item
|
||||||
|
@ -4,6 +4,7 @@ from . import feeds
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("syndication/rss2/", feeds.TestRss2Feed()),
|
path("syndication/rss2/", feeds.TestRss2Feed()),
|
||||||
|
path("syndication/rss2/with-static-methods/", feeds.TestRss2FeedWithStaticMethod()),
|
||||||
path("syndication/rss2/articles/<int:entry_id>/", feeds.TestGetObjectFeed()),
|
path("syndication/rss2/articles/<int:entry_id>/", feeds.TestGetObjectFeed()),
|
||||||
path(
|
path(
|
||||||
"syndication/rss2/guid_ispermalink_true/",
|
"syndication/rss2/guid_ispermalink_true/",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user