Skip to content

Commit 03b7356

Browse files
committed
Minor refactorings to move some utils code around and remove unneeded code.
1 parent 6315f86 commit 03b7356

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

tests/test_algorithms.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818

1919
class TestAlgorithms(unittest.TestCase):
20-
def setUp(self): # noqa
21-
pass
22-
2320
def test_algorithm_should_throw_exception_if_prepare_key_not_impl(self):
2421
algo = Algorithm()
2522

tests/test_api.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import pytest
2020

2121
from .compat import string_types, text_type, unittest
22-
from .utils import ensure_bytes
22+
from .utils import ensure_bytes, utc_timestamp
2323

2424
try:
2525
from cryptography.hazmat.backends import default_backend
@@ -32,10 +32,6 @@
3232
has_crypto = False
3333

3434

35-
def utc_timestamp():
36-
return timegm(datetime.utcnow().utctimetuple())
37-
38-
3935
class TestAPI(unittest.TestCase):
4036

4137
def setUp(self): # noqa

tests/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import os
22

3+
from calendar import timegm
4+
from datetime import datetime
5+
36
from .compat import text_type
47

58

@@ -17,6 +20,10 @@ def ensure_unicode(key):
1720
return key
1821

1922

23+
def utc_timestamp():
24+
return timegm(datetime.utcnow().utctimetuple())
25+
26+
2027
def key_path(key_name):
2128
return os.path.join(os.path.dirname(os.path.realpath(__file__)),
2229
'keys', key_name)

0 commit comments

Comments
 (0)