diff options
| author | Mohammadreza Varasteh <varastehmr@gmail.com> | 2021-05-26 21:51:19 +0430 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-05-27 21:05:28 +0200 |
| commit | e93eb3d9714be0b489891f4d2da41bb4df4978a5 (patch) | |
| tree | 09b55157906f6f019d412d28809ea5383bb82ce3 /tests/syndication_tests/tests.py | |
| parent | 02c59b7a4355fda8c99224b5de9c0a3929bffe22 (diff) | |
Fixed #32789 -- Made feeds emit elements with no content as self-closing tags.
Diffstat (limited to 'tests/syndication_tests/tests.py')
| -rw-r--r-- | tests/syndication_tests/tests.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/syndication_tests/tests.py b/tests/syndication_tests/tests.py index 6c4fe07506..5a668911f5 100644 --- a/tests/syndication_tests/tests.py +++ b/tests/syndication_tests/tests.py @@ -7,7 +7,9 @@ from django.core.exceptions import ImproperlyConfigured from django.test import TestCase, override_settings from django.test.utils import requires_tz_support from django.utils import timezone -from django.utils.feedgenerator import rfc2822_date, rfc3339_date +from django.utils.feedgenerator import ( + Atom1Feed, Rss201rev2Feed, rfc2822_date, rfc3339_date, +) from .models import Article, Entry @@ -420,6 +422,22 @@ class SyndicationFeedTest(FeedTestCase): published = doc.getElementsByTagName('published')[0].firstChild.wholeText self.assertEqual(published[-6:], '+00:42') + def test_feed_no_content_self_closing_tag(self): + tests = [ + (Atom1Feed, 'link'), + (Rss201rev2Feed, 'atom:link'), + ] + for feedgenerator, tag in tests: + with self.subTest(feedgenerator=feedgenerator.__name__): + feed = feedgenerator( + title='title', + link='https://example.com', + description='self closing tags test', + feed_url='https://feed.url.com', + ) + doc = feed.writeString('utf-8') + self.assertIn(f'<{tag} href="https://feed.url.com" rel="self"/>', doc) + @requires_tz_support def test_feed_last_modified_time_naive_date(self): """ |
