mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #26653 -- Made SyndicationFeed.latest_post_date() return time in UTC.
This commit is contained in:
parent
92107522ed
commit
f31fbbae1a
4 changed files with 24 additions and 7 deletions
|
@ -1,13 +1,13 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import datetime
|
||||
import unittest
|
||||
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils import feedgenerator
|
||||
from django.utils.timezone import get_fixed_timezone
|
||||
from django.utils.timezone import get_fixed_timezone, utc
|
||||
|
||||
|
||||
class FeedgeneratorTest(unittest.TestCase):
|
||||
class FeedgeneratorTest(SimpleTestCase):
|
||||
"""
|
||||
Tests for the low-level syndication feed framework.
|
||||
"""
|
||||
|
@ -121,3 +121,9 @@ class FeedgeneratorTest(unittest.TestCase):
|
|||
self.assertIn('<atom:link', feed_content)
|
||||
self.assertIn('href="/feed/"', feed_content)
|
||||
self.assertIn('rel="self"', feed_content)
|
||||
|
||||
def test_latest_post_date_returns_utc_time(self):
|
||||
for use_tz in (True, False):
|
||||
with self.settings(USE_TZ=use_tz):
|
||||
rss_feed = feedgenerator.Rss201rev2Feed('title', 'link', 'description')
|
||||
self.assertEqual(rss_feed.latest_post_date().tzinfo, utc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue