diff options
Diffstat (limited to 'tests/syndication_tests/tests.py')
| -rw-r--r-- | tests/syndication_tests/tests.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/syndication_tests/tests.py b/tests/syndication_tests/tests.py index b763bba6cb..35b68e849b 100644 --- a/tests/syndication_tests/tests.py +++ b/tests/syndication_tests/tests.py @@ -38,7 +38,12 @@ class FeedTestCase(TestCase): title='My last entry', updated=datetime.datetime(2013, 1, 20, 0, 0), published=datetime.datetime(2013, 3, 25, 20, 0) ) - cls.a1 = Article.objects.create(title='My first article', entry=cls.e1) + cls.a1 = Article.objects.create( + title='My first article', + entry=cls.e1, + updated=datetime.datetime(1986, 11, 21, 9, 12, 18), + published=datetime.datetime(1986, 10, 21, 9, 12, 18), + ) def assertChildNodes(self, elem, expected): actual = {n.nodeName for n in elem.childNodes} @@ -522,3 +527,22 @@ class SyndicationFeedTest(FeedTestCase): for prefix in prefix_domain_mapping: with self.subTest(prefix=prefix): self.assertEqual(views.add_domain(*prefix[0]), prefix[1]) + + def test_get_object(self): + response = self.client.get('/syndication/rss2/articles/%s/' % self.e1.pk) + doc = minidom.parseString(response.content) + feed = doc.getElementsByTagName('rss')[0] + chan = feed.getElementsByTagName('channel')[0] + items = chan.getElementsByTagName('item') + + self.assertChildNodeContent(items[0], { + 'comments': '/blog/1/article/1/comments', + 'description': 'Article description: My first article', + 'link': 'http://example.com/blog/1/article/1/', + 'title': 'Title: My first article', + 'pubDate': rfc2822_date(timezone.make_aware(self.a1.published, TZ)), + }) + + def test_get_non_existent_object(self): + response = self.client.get('/syndication/rss2/articles/0/') + self.assertEqual(response.status_code, 404) |
