diff --git a/tests/syndication_tests/feeds.py b/tests/syndication_tests/feeds.py index 17d807f302..922be13e9a 100644 --- a/tests/syndication_tests/feeds.py +++ b/tests/syndication_tests/feeds.py @@ -39,6 +39,12 @@ class TestRss2Feed(views.Feed): item_copyright = "Copyright (c) 2007, Sally Smith" +class TestRss2FeedWithStaticMethod(TestRss2Feed): + @staticmethod + def categories(): + return ("javascript", "vue") + + class TestRss2FeedWithGuidIsPermaLinkTrue(TestRss2Feed): def item_guid_is_permalink(self, item): return True diff --git a/tests/syndication_tests/tests.py b/tests/syndication_tests/tests.py index 464ca76d54..b5338738e5 100644 --- a/tests/syndication_tests/tests.py +++ b/tests/syndication_tests/tests.py @@ -196,6 +196,12 @@ class SyndicationFeedTest(FeedTestCase): 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): """ Test if the 'isPermaLink' attribute of element of an item diff --git a/tests/syndication_tests/urls.py b/tests/syndication_tests/urls.py index 511f977ebc..613f83489c 100644 --- a/tests/syndication_tests/urls.py +++ b/tests/syndication_tests/urls.py @@ -4,6 +4,7 @@ from . import feeds urlpatterns = [ path("syndication/rss2/", feeds.TestRss2Feed()), + path("syndication/rss2/with-static-methods/", feeds.TestRss2FeedWithStaticMethod()), path("syndication/rss2/articles//", feeds.TestGetObjectFeed()), path( "syndication/rss2/guid_ispermalink_true/",