Skip to content

Commit

Permalink
Set explicit TZ for test
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Nov 1, 2015
1 parent 49f5264 commit c74b507
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cms/tests/admin.py
Expand Up @@ -373,11 +373,13 @@ def test_delete_translation(self):

def test_change_dates(self):
admin_user, staff = self._get_guys()
page = create_page('test-page', 'nav_playground.html', 'en')
page.publish('en')
draft = page.get_draft_object()

with self.settings(USE_TZ=False):
with self.settings(USE_TZ=False, TIME_ZONE='UTC'):

page = create_page('test-page', 'nav_playground.html', 'en')
page.publish('en')
draft = page.get_draft_object()

original_date = draft.publication_date
original_end_date = draft.publication_end_date
new_date = timezone.now() - datetime.timedelta(days=1)
Expand All @@ -400,7 +402,12 @@ def test_change_dates(self):
if original_end_date:
self.assertNotEqual(draft.publication_end_date.timetuple(), original_end_date.timetuple())

with self.settings(USE_TZ=True):
with self.settings(USE_TZ=True, TIME_ZONE='UTC'):

page = create_page('test-page-2', 'nav_playground.html', 'en')
page.publish('en')
draft = page.get_draft_object()

original_date = draft.publication_date
original_end_date = draft.publication_end_date
new_date = timezone.localtime(timezone.now()) - datetime.timedelta(days=1)
Expand Down

0 comments on commit c74b507

Please sign in to comment.