summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMark Adams <mark@markadams.me>2015-04-12 22:26:40 -0500
committerMark Adams <madams@atlassian.com>2015-04-14 09:53:39 -0500
commit03b7356e1a6eec42aa28ff3c1fa40a56aaa3603d (patch)
tree2319772b857458056d7c8980ab83f15483c2d2e5 /tests
parent6315f8694348ef64560eaf6f878247ae5b6cdc08 (diff)
downloadpyjwt-03b7356e1a6eec42aa28ff3c1fa40a56aaa3603d.tar.gz
Minor refactorings to move some utils code around and remove unneeded code.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_algorithms.py3
-rw-r--r--tests/test_api.py6
-rw-r--r--tests/utils.py7
3 files changed, 8 insertions, 8 deletions
diff --git a/tests/test_algorithms.py b/tests/test_algorithms.py
index 24d5f15..d403d3e 100644
--- a/tests/test_algorithms.py
+++ b/tests/test_algorithms.py
@@ -17,9 +17,6 @@ except ImportError:
class TestAlgorithms(unittest.TestCase):
- def setUp(self): # noqa
- pass
-
def test_algorithm_should_throw_exception_if_prepare_key_not_impl(self):
algo = Algorithm()
diff --git a/tests/test_api.py b/tests/test_api.py
index 43ce780..5067ba3 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -19,7 +19,7 @@ from jwt.utils import base64url_decode
import pytest
from .compat import string_types, text_type, unittest
-from .utils import ensure_bytes
+from .utils import ensure_bytes, utc_timestamp
try:
from cryptography.hazmat.backends import default_backend
@@ -32,10 +32,6 @@ except ImportError:
has_crypto = False
-def utc_timestamp():
- return timegm(datetime.utcnow().utctimetuple())
-
-
class TestAPI(unittest.TestCase):
def setUp(self): # noqa
diff --git a/tests/utils.py b/tests/utils.py
index 4d455b5..bf74e78 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -1,5 +1,8 @@
import os
+from calendar import timegm
+from datetime import datetime
+
from .compat import text_type
@@ -17,6 +20,10 @@ def ensure_unicode(key):
return key
+def utc_timestamp():
+ return timegm(datetime.utcnow().utctimetuple())
+
+
def key_path(key_name):
return os.path.join(os.path.dirname(os.path.realpath(__file__)),
'keys', key_name)