| 63 | |
| 64 | class Issue14202PatchTest(unittest.TestCase): |
| 65 | """ |
| 66 | There is a bug in django.utils.feedgenerator.Rss201rev2Feed that has been |
| 67 | reported in #14202 before. |
| 68 | |
| 69 | http://code.djangoproject.com/ticket/14202 |
| 70 | |
| 71 | The feed_url property is optional but was required later on to write the |
| 72 | atom:link attribute to the RSS-feed. |
| 73 | |
| 74 | It is perfectly fine to leave the feed_url property as optional since it |
| 75 | is not required by RSS (http://bit.ly/bAZpKT). Therefore the patch only |
| 76 | renders the atom:link attribute if a feed_url is given. |
| 77 | """ |
| 78 | |
| 79 | def test_feed_without_feed_url_gets_rendered_without_atom_link(self): |
| 80 | feed = feedgenerator.Rss201rev2Feed('title', '/link/', 'descr') |
| 81 | feed_content = feed.writeString('utf-8') |
| 82 | |
| 83 | self.assertEquals(feed.feed['feed_url'], None) |
| 84 | self.assertFalse('<atom:link href=' in feed_content) |
| 85 | |
| 86 | def test_feed_with_feed_url_gets_rendered_with_atom_link(self): |
| 87 | feed = feedgenerator.Rss201rev2Feed('title', '/link/', 'descr', feed_url='/feed/') |
| 88 | feed_content = feed.writeString('utf-8') |
| 89 | |
| 90 | self.assertEquals(feed.feed['feed_url'], '/feed/') |
| 91 | self.assertTrue('<atom:link href="/feed/" rel="self"></atom:link>' in \ |
| 92 | feed_content) |
| 93 | |