summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWouter Bolsterlee <wouter@intelworks.com>2015-01-05 19:38:17 +0100
committerWouter Bolsterlee <wouter@intelworks.com>2015-01-05 19:39:09 +0100
commitc725a471ce65d9b5f1ac8f10f6624d3ab2208aef (patch)
tree2893b1aa3950258af206e87786097a332ac2bf03
parent1a38e31b4d4b2a266a2ea544ec10fe269c880b6f (diff)
downloadpyjwt-c725a471ce65d9b5f1ac8f10f6624d3ab2208aef.tar.gz
Avoid ResourceWarning in tests
-rw-r--r--tests/test_jwt.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test_jwt.py b/tests/test_jwt.py
index 04146a2..8097993 100644
--- a/tests/test_jwt.py
+++ b/tests/test_jwt.py
@@ -108,7 +108,8 @@ class TestJWT(unittest.TestCase):
@unittest.skipIf(not has_crypto, "Can't run without cryptography library")
def test_decodes_valid_es384_jwt(self):
example_payload = {'hello': 'world'}
- example_pubkey = open('tests/testkey_ec.pub', 'r').read()
+ with open('tests/testkey_ec.pub', 'r') as fp:
+ example_pubkey = fp.read()
example_jwt = (
b'eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9'
b'.eyJoZWxsbyI6IndvcmxkIn0'
@@ -128,7 +129,8 @@ class TestJWT(unittest.TestCase):
@unittest.skipIf(not has_crypto, "Can't run without cryptography library")
def test_decodes_valid_rs384_jwt(self):
example_payload = {'hello': 'world'}
- example_pubkey = open('tests/testkey_rsa.pub', 'r').read()
+ with open('tests/testkey_rsa.pub', 'r') as fp:
+ example_pubkey = fp.read()
example_jwt = (
b'eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9'
b'.eyJoZWxsbyI6IndvcmxkIn0'