Commit 902b0321 authored by Michal Čihař's avatar Michal Čihař

Use timezone aware timestamps in tests

Issue #892
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent d0a6fd1f
......@@ -24,6 +24,7 @@ Testing of natural time conversion.
from unittest import TestCase
from weblate.trans.templatetags.translations import naturaltime
import datetime
from django.utils import timezone
TEST_DATA = (
(0, 'now'),
......@@ -60,7 +61,7 @@ TEST_DATA = (
class NaturalTimeTest(TestCase):
def test_natural(self):
now = datetime.datetime.now()
now = timezone.now()
for diff, expected in TEST_DATA:
testdate = now + datetime.timedelta(seconds=diff)
result = naturaltime(testdate, now)
......
......@@ -27,7 +27,7 @@ from django.test import TestCase
import tempfile
import shutil
import os.path
import datetime
from django.utils import timezone
class GithubFakeRepository(GithubRepository):
......@@ -116,7 +116,7 @@ class VCSGitTest(RepoTestCase):
repo.commit(
'Test commit',
'Foo Bar <foo@bar.com>',
datetime.datetime.now(),
timezone.now(),
[filename]
)
......@@ -290,7 +290,7 @@ class VCSGitTest(RepoTestCase):
self.repo.commit(
'Test commit',
'Foo Bar <foo@bar.com>',
datetime.datetime.now(),
timezone.now(),
['testfile']
)
# Check we have new revision
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment