Fix _is_expired_token issues (#47)

This commit is contained in:
SearchDream
2017-11-17 15:59:33 +03:00
committed by Sergey Petrov
parent c272fa8bf2
commit bbe8528acf
4 changed files with 15 additions and 10 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ class TokenCredentials(Credentials):
@staticmethod @staticmethod
def _is_expired_token(issue_date): def _is_expired_token(issue_date):
return time.time() < issue_date + DEFAULT_TOKEN_LIFETIME return time.time() > issue_date + DEFAULT_TOKEN_LIFETIME
@staticmethod @staticmethod
def _get_signing_key(key_path): def _get_signing_key(key_path):
+1
View File
@@ -1 +1,2 @@
freezegun
mock; python_version < '3.3' mock; python_version < '3.3'
+4
View File
@@ -6,6 +6,8 @@
from unittest import TestCase, main from unittest import TestCase, main
from freezegun import freeze_time
import time import time
from apns2.credentials import TokenCredentials from apns2.credentials import TokenCredentials
@@ -28,6 +30,8 @@ class TokenCredentialsTestCase(TestCase):
self.team_id) self.team_id)
self.lasting_header = self.normal_creds.get_authorization_header( self.lasting_header = self.normal_creds.get_authorization_header(
self.topics[0]) self.topics[0])
with freeze_time('2012-01-14'):
self.expiring_creds = \ self.expiring_creds = \
TokenCredentials(self.key_path, self.key_id, TokenCredentials(self.key_path, self.key_id,
self.team_id, self.team_id,
+1 -1
View File
@@ -6,6 +6,6 @@ commands = nosetests []
deps = deps =
nose nose
py27: mock -rrequirements-dev.txt
usedevelop=True usedevelop=True