From 5760537da67ccf33003467d4ae18832b336279f0 Mon Sep 17 00:00:00 2001 From: Tuomas Suutari Date: Tue, 12 Dec 2017 13:28:36 +0200 Subject: [PATCH] Revert "Amend tests for changes is timestamp formatting" This reverts commit 49c25235d427d9b49001a473aee236a0c8490c98. --- parkings/tests/api/enforcement/test_valid_parking.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/parkings/tests/api/enforcement/test_valid_parking.py b/parkings/tests/api/enforcement/test_valid_parking.py index 1e9abd4b..b3d2ce55 100644 --- a/parkings/tests/api/enforcement/test_valid_parking.py +++ b/parkings/tests/api/enforcement/test_valid_parking.py @@ -2,7 +2,7 @@ import pytest from django.core.urlresolvers import reverse -from django.utils.timezone import localtime, utc +from django.utils.timezone import utc from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN from ..utils import ( @@ -97,17 +97,11 @@ def check_parking_data_matches_parking_object(parking_data, parking_obj): def iso8601(dt): - return add_colon_to_tz(localtime(dt).strftime('%Y-%m-%dT%H:%M:%S%z')) + return dt.strftime('%Y-%m-%dT%H:%M:%SZ') def iso8601_us(dt): - return add_colon_to_tz(localtime(dt).strftime('%Y-%m-%dT%H:%M:%S.%f%z')) - - -def add_colon_to_tz(timestamp_string): - assert isinstance(timestamp_string, str) - assert timestamp_string[-4:].isdigit(), "Last 4 chars should be digits" - return timestamp_string[:-2] + ':' + timestamp_string[-2:] + return dt.strftime('%Y-%m-%dT%H:%M:%S.%fZ') def test_registration_number_filter(operator, staff_api_client, parking_factory):