Code

Ticket #14202: reproduction_tests.py

File reproduction_tests.py, 858 bytes (added by fabian, 4 years ago)

Reproducing the bug and that feed_url property is causing it

Line 
1#!/usr/bin/env python
2# encoding: utf-8
3import unittest
4
5from django.utils.feedgenerator import Rss201rev2Feed
6
7
8class Issue14202TestCase(unittest.TestCase):
9    """
10    There is a bug in django.utils.feedgenerator.Rss201rev2Feed that has been
11    reported in #14202 before.
12
13    http://code.djangoproject.com/ticket/14202
14
15    The feed_url property is optional but required later on to write the feed.
16    """
17    def test_bug_reproduction(self):
18        feed = Rss201rev2Feed('title', '/link/', 'descr')
19        self.assertEquals(feed.feed['feed_url'], None)
20        self.assertRaises(AttributeError, feed.writeString, 'utf-8')
21
22    def test_bug_caused_by_missing_feed_url_property(self):
23        feed = Rss201rev2Feed('title', '/link/', 'descr', feed_url='/feed/')
24        assert feed.writeString('utf-8')
25
26
27if __name__ == '__main__':
28    unittest.main()