diff options
Diffstat (limited to 'tests/syndication_tests/tests.py')
| -rw-r--r-- | tests/syndication_tests/tests.py | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/tests/syndication_tests/tests.py b/tests/syndication_tests/tests.py index b5338738e5..dc4232e61d 100644 --- a/tests/syndication_tests/tests.py +++ b/tests/syndication_tests/tests.py @@ -196,11 +196,38 @@ 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/") + def test_rss2_feed_with_decorated_methods(self): + response = self.client.get("/syndication/rss2/with-decorated-methods/") doc = minidom.parseString(response.content) chan = doc.getElementsByTagName("rss")[0].getElementsByTagName("channel")[0] self.assertCategories(chan, ["javascript", "vue"]) + self.assertChildNodeContent( + chan, + { + "title": "Overridden title -- decorated by @wraps.", + "description": "Overridden description -- decorated by @wraps.", + "ttl": "800 -- decorated by @wraps.", + "copyright": "Copyright (c) 2022, John Doe -- decorated by @wraps.", + }, + ) + items = chan.getElementsByTagName("item") + self.assertChildNodeContent( + items[0], + { + "title": ( + f"Overridden item title: {self.e1.title} -- decorated by @wraps." + ), + "description": "Overridden item description -- decorated by @wraps.", + }, + ) + + def test_rss2_feed_with_wrong_decorated_methods(self): + msg = ( + "Feed method 'item_description' decorated by 'wrapper' needs to use " + "@functools.wraps." + ) + with self.assertRaisesMessage(ImproperlyConfigured, msg): + self.client.get("/syndication/rss2/with-wrong-decorated-methods/") def test_rss2_feed_guid_permalink_false(self): """ |
