Format datetime to local timezone
This commit is contained in:
+13
-5
@@ -5,6 +5,7 @@ from unittest import skip
|
||||
from django.contrib.auth.models import User
|
||||
from members.models import Member, Payment, Request
|
||||
from rest_framework.authtoken.models import Token
|
||||
from datetime import timezone
|
||||
|
||||
|
||||
import logging
|
||||
@@ -108,8 +109,11 @@ class MemberRegisterTestCase(TestCase):
|
||||
|
||||
content = resp.content
|
||||
arrays = pyexcel.get_array(file_content=content, file_type="xlsx")
|
||||
created = Payment.objects.get(member__email="tidus@tester.fi").date.strftime(
|
||||
"%Y-%m-%d %H:%M:%S"
|
||||
created = (
|
||||
Payment.objects.get(member__email="tidus@tester.fi")
|
||||
.date.replace(tzinfo=timezone.utc)
|
||||
.astimezone(tz=None)
|
||||
.strftime("%Y-%m-%d %H:%M:%S")
|
||||
)
|
||||
tidus_array = ["Tidus Tester", created, "AYY"]
|
||||
self.assertIn(tidus_array, arrays)
|
||||
@@ -122,9 +126,13 @@ class MemberRegisterTestCase(TestCase):
|
||||
|
||||
content = resp.content
|
||||
arrays = pyexcel.get_array(file_content=content, file_type="xlsx")
|
||||
submitted = Request.objects.get(
|
||||
email="liisa.mattila@pylly.com"
|
||||
).submitted.strftime("%Y-%m-%d %H:%M:%S")
|
||||
submitted = (
|
||||
Request.objects.get(email="liisa.mattila@pylly.com")
|
||||
.submitted.replace(tzinfo=timezone.utc)
|
||||
.astimezone(tz=None)
|
||||
.strftime("%Y-%m-%d %H:%M:%S")
|
||||
)
|
||||
|
||||
liisa_array = [
|
||||
"Liisa",
|
||||
"Mattila",
|
||||
|
||||
Reference in New Issue
Block a user