diff --git a/.travis.yml b/.travis.yml index 244d37f..1766bf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,9 @@ python: - "3.2" - "3.3" - "3.4" - - "3.5.0b3" - - "3.5-dev" + - "3.5" + - "3.6" + - "3.7-dev" - "nightly" - "pypy" - "pypy3" diff --git a/requirements/tests.txt b/requirements/tests.txt index 102afd9..32498f5 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,2 +1,2 @@ -r production.txt -timecop +freezegun diff --git a/tests/__init__.py b/tests/__init__.py index 58dfb2e..4739677 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -3,7 +3,7 @@ """ import six import time -import timecop +import freezegun as fg from unittest import TestCase from onetimepass import ( @@ -188,7 +188,7 @@ def test_generating_current_totp_and_validating(self): created HOTP for proper interval """ secret = b'MFRGGZDFMZTWQ2LK' - with timecop.freeze(time.time()): + with fg.freeze_time(): hotp = get_hotp(secret=secret, intervals_no=int(time.time())//30,) totp = get_totp(secret=secret) self.assertEqual(hotp, totp) @@ -198,7 +198,7 @@ def test_generating_current_totp_as_string(self): Check if the TOTP also works seamlessly when generated as string """ secret = b'MFRGGZDFMZTWQ2LK' - with timecop.freeze(time.time()): + with fg.freeze_time(): hotp = get_hotp( secret=secret, intervals_no=int(time.time())//30, @@ -213,7 +213,7 @@ def test_generating_totp_at_specific_clock(self): which is basically the same as hotp """ secret = b'MFRGGZDFMZTWQ2LK' - with timecop.freeze(time.time()): + with fg.freeze_time(): hotp = get_hotp(secret=secret, intervals_no=int(time.time())//30,) totp = get_totp(secret=secret, clock=None) self.assertEqual(hotp, totp) @@ -232,7 +232,7 @@ def test_validating_totp_with_a_window(self): validate if a totp token falls within a certain window """ secret = b'MFRGGZDFMZTWQ2LK' - with timecop.freeze(time.time()): + with fg.freeze_time(): totp = get_totp(secret=secret, clock=(int(time.time()-30))) self.assertFalse(valid_totp(totp, secret)) self.assertTrue(valid_totp(totp, secret, window=1)) @@ -256,7 +256,7 @@ def test_validating_totp_for_same_secret(self): Check if validating TOTP generated for the same secret works """ secret = b'MFRGGZDFMZTWQ2LK' - with timecop.freeze(time.time()): + with fg.freeze_time(): self.assertTrue(valid_totp(get_totp(secret), secret)) def test_validating_invalid_totp_for_same_secret(self): @@ -264,7 +264,7 @@ def test_validating_invalid_totp_for_same_secret(self): Test case when the same secret is used, but the token differs """ secret = b'MFRGGZDFMZTWQ2LK' - with timecop.freeze(time.time()): + with fg.freeze_time(): self.assertFalse(valid_totp(get_totp(secret)+1, secret)) def test_validating_correct_hotp_as_totp(self): @@ -273,5 +273,5 @@ def test_validating_correct_hotp_as_totp(self): very big interval number (matching Unix epoch timestamp) """ secret = b'MFRGGZDFMZTWQ2LK' - with timecop.freeze(time.time()): + with fg.freeze_time(): self.assertFalse(valid_totp(get_hotp(secret, 1), secret))