Ticket #18321: django-ticket18321.diff

File django-ticket18321.diff, 3.6 KB (added by manfre, 3 years ago)
  • tests/regressiontests/generic_views/dates.py

    diff --git a/tests/regressiontests/generic_views/dates.py b/tests/regressiontests/generic_views/dates.py
    index 98c089f..b4690c1 100644
    a b from __future__ import absolute_import 
    33import datetime
    44
    55from django.core.exceptions import ImproperlyConfigured
     6from django.db import connection
    67from django.test import TestCase
    78from django.test.utils import override_settings
    8 from django.utils import timezone
     9from django.utils import timezone, unittest
    910
    1011from .models import Book, BookSigning
    1112
    class ArchiveIndexViewTests(TestCase): 
    9596        res = self.client.get('/dates/booksignings/')
    9697        self.assertEqual(res.status_code, 200)
    9798
     99    @unittest.skipIf(not connection.features.supports_timezones,
     100        "Database backend does not support timezones")
    98101    @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
    99102    def test_aware_datetime_archive_view(self):
    100103        BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
    class YearArchiveViewTests(TestCase): 
    160163        res = self.client.get('/dates/booksignings/2008/')
    161164        self.assertEqual(res.status_code, 200)
    162165
     166    @unittest.skipIf(not connection.features.supports_timezones,
     167        "Database backend does not support timezones")
    163168    @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
    164169    def test_aware_datetime_year_view(self):
    165170        BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
    class MonthArchiveViewTests(TestCase): 
    278283        res = self.client.get('/dates/booksignings/2008/apr/')
    279284        self.assertEqual(res.status_code, 200)
    280285
     286    @unittest.skipIf(not connection.features.supports_timezones,
     287        "Database backend does not support timezones")
    281288    @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
    282289    def test_aware_datetime_month_view(self):
    283290        BookSigning.objects.create(event_date=datetime.datetime(2008, 2, 1, 12, 0, tzinfo=timezone.utc))
    class WeekArchiveViewTests(TestCase): 
    377384        res = self.client.get('/dates/booksignings/2008/week/13/')
    378385        self.assertEqual(res.status_code, 200)
    379386
     387    @unittest.skipIf(not connection.features.supports_timezones,
     388        "Database backend does not support timezones")
    380389    @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
    381390    def test_aware_datetime_week_view(self):
    382391        BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
    class DayArchiveViewTests(TestCase): 
    477486        res = self.client.get('/dates/booksignings/2008/apr/2/')
    478487        self.assertEqual(res.status_code, 200)
    479488
     489    @unittest.skipIf(not connection.features.supports_timezones,
     490        "Database backend does not support timezones")
    480491    @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
    481492    def test_aware_datetime_day_view(self):
    482493        bs = BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
    class DateDetailViewTests(TestCase): 
    553564        res = self.client.get('/dates/booksignings/2008/apr/2/%d/' % bs.pk)
    554565        self.assertEqual(res.status_code, 200)
    555566
     567    @unittest.skipIf(not connection.features.supports_timezones,
     568        "Database backend does not support timezones")
    556569    @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
    557570    def test_aware_datetime_date_detail(self):
    558571        bs = BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
Back to Top