From 22d738c2dc87c073c20051c9fd19fa2c2887dbaa Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sat, 15 Oct 2011 10:16:24 +0000 Subject: [PATCH] Ensured that the feeds framework supports both datetimes and dates. Refs #4076. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16989 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/utils/feedgenerator.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/regressiontests/utils/feedgenerator.py b/tests/regressiontests/utils/feedgenerator.py index bcb4286e89..dd20f02757 100644 --- a/tests/regressiontests/utils/feedgenerator.py +++ b/tests/regressiontests/utils/feedgenerator.py @@ -42,6 +42,15 @@ class FeedgeneratorTest(unittest.TestCase): "Fri, 14 Nov 2008 13:37:00 +0100" ) + def test_rfc2822_date_without_time(self): + """ + Test rfc2822_date() correctly formats date objects. + """ + self.assertEqual( + feedgenerator.rfc2822_date(datetime.date(2008, 11, 14)), + "Fri, 14 Nov 2008 00:00:00 -0000" + ) + def test_rfc3339_date(self): """ Test rfc3339_date() correctly formats datetime objects. @@ -60,6 +69,15 @@ class FeedgeneratorTest(unittest.TestCase): "2008-11-14T13:37:00+02:00" ) + def test_rfc3339_date_without_time(self): + """ + Test rfc3339_date() correctly formats date objects. + """ + self.assertEqual( + feedgenerator.rfc3339_date(datetime.date(2008, 11, 14)), + "2008-11-14T00:00:00Z" + ) + def test_atom1_mime_type(self): """ Test to make sure Atom MIME type has UTF8 Charset parameter set