diff --git a/tests/syndication/tests.py b/tests/syndication/tests.py
index 1627f71..828de7a 100644
a
|
b
|
|
1 | 1 | from __future__ import absolute_import, unicode_literals |
2 | 2 | |
| 3 | import time |
3 | 4 | from xml.dom import minidom |
4 | 5 | |
5 | 6 | from django.contrib.syndication import views |
… |
… |
from django.core.exceptions import ImproperlyConfigured
|
7 | 8 | from django.test import TestCase |
8 | 9 | from django.utils import tzinfo |
9 | 10 | from django.utils.feedgenerator import rfc2822_date, rfc3339_date |
| 11 | from django.utils.unittest import skipUnless |
10 | 12 | |
11 | 13 | from .models import Entry |
12 | 14 | |
13 | 15 | |
| 16 | # Taken from tests/timezones/tests.py |
| 17 | TZ_SUPPORT = hasattr(time, 'tzset') |
| 18 | |
| 19 | # On OSes that don't provide tzset (Windows), we can't set the timezone |
| 20 | # in which the program runs. As a consequence, we must skip tests that |
| 21 | # don't enforce a specific timezone (with timezone.override or equivalent), |
| 22 | # or attempt to interpret naive datetimes in the default timezone. |
| 23 | |
| 24 | requires_tz_support = skipUnless(TZ_SUPPORT, |
| 25 | "This test relies on the ability to run a program in an arbitrary " |
| 26 | "time zone, but your operating system isn't able to do that.") |
| 27 | |
| 28 | |
14 | 29 | class FeedTestCase(TestCase): |
15 | 30 | fixtures = ['feeddata.json'] |
16 | 31 | |
… |
… |
class SyndicationFeedTest(FeedTestCase):
|
260 | 275 | updated = doc.getElementsByTagName('updated')[0].firstChild.wholeText |
261 | 276 | self.assertEqual(updated[-6:], '+00:42') |
262 | 277 | |
263 | | def test_feed_last_modified_time(self): |
| 278 | @requires_tz_support |
| 279 | def test_feed_last_modified_time_naive_date(self): |
| 280 | """ |
| 281 | Tests the Last-Modified header with naive publication dates |
| 282 | """ |
264 | 283 | response = self.client.get('/syndication/naive-dates/') |
265 | 284 | self.assertEqual(response['Last-Modified'], 'Thu, 03 Jan 2008 19:30:00 GMT') |
266 | 285 | |
| 286 | def test_feed_last_modified_time(self): |
| 287 | response = self.client.get('/syndication/aware-dates/') |
| 288 | self.assertEqual(response['Last-Modified'], 'Thu, 03 Jan 2008 12:48:00 GMT') |
| 289 | |
267 | 290 | # No last-modified when feed has no item_pubdate |
268 | 291 | response = self.client.get('/syndication/no_pubdate/') |
269 | 292 | self.assertFalse(response.has_header('Last-Modified')) |