Skip to content

Commit 1e7a716

Browse files
committed
Fix some unit tests
1 parent beaa9ac commit 1e7a716

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

tests/test_blacklist.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import unittest
22
import json
33

4-
import simplekv.memory
54
from flask import Flask, jsonify, request
65
from flask_jwt_extended.utils import get_jwt_identity, get_jti
76

@@ -17,7 +16,6 @@ def setUp(self):
1716
self.app = Flask(__name__)
1817
self.app.secret_key = 'super=secret'
1918
self.app.config['JWT_BLACKLIST_ENABLED'] = True
20-
self.app.config['JWT_BLACKLIST_STORE'] = simplekv.memory.DictStore()
2119
self.jwt_manager = JWTManager(self.app)
2220
self.client = self.app.test_client()
2321
self.blacklist = set()

tests/test_config.py

-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def test_override_configs(self):
8585
self.app.config['JWT_ALGORITHM'] = 'HS512'
8686

8787
self.app.config['JWT_BLACKLIST_ENABLED'] = True
88-
self.app.config['JWT_BLACKLIST_STORE'] = sample_store
8988
self.app.config['JWT_BLACKLIST_TOKEN_CHECKS'] = 'refresh'
9089

9190
self.app.secret_key = 'banana'

tests/test_jwt_encode_decode.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_encode_access_token(self):
3636
identity = 'user1'
3737
token = encode_access_token(identity, secret, algorithm, token_expire_delta,
3838
fresh=True, user_claims=user_claims, csrf=False)
39-
data = jwt.decode(token, secret, algorithm=algorithm)
39+
data = jwt.decode(token, secret, algorithms=[algorithm])
4040
self.assertIn('exp', data)
4141
self.assertIn('iat', data)
4242
self.assertIn('nbf', data)
@@ -60,7 +60,7 @@ def test_encode_access_token(self):
6060
identity = 12345 # identity can be anything json serializable
6161
token = encode_access_token(identity, secret, algorithm, token_expire_delta,
6262
fresh=False, user_claims=user_claims, csrf=True)
63-
data = jwt.decode(token, secret, algorithm=algorithm)
63+
data = jwt.decode(token, secret, algorithms=[algorithm])
6464
self.assertIn('exp', data)
6565
self.assertIn('iat', data)
6666
self.assertIn('nbf', data)
@@ -105,7 +105,7 @@ def test_encode_refresh_token(self):
105105
identity = 'user1'
106106
token = encode_refresh_token(identity, secret, algorithm,
107107
token_expire_delta, csrf=False)
108-
data = jwt.decode(token, secret, algorithm=algorithm)
108+
data = jwt.decode(token, secret, algorithms=[algorithm])
109109
self.assertIn('exp', data)
110110
self.assertIn('iat', data)
111111
self.assertIn('nbf', data)
@@ -125,7 +125,7 @@ def test_encode_refresh_token(self):
125125
identity = 12345 # identity can be anything json serializable
126126
token = encode_refresh_token(identity, secret, algorithm,
127127
token_expire_delta, csrf=True)
128-
data = jwt.decode(token, secret, algorithm=algorithm)
128+
data = jwt.decode(token, secret, algorithms=[algorithm])
129129
self.assertIn('exp', data)
130130
self.assertIn('iat', data)
131131
self.assertIn('nbf', data)

0 commit comments

Comments
 (0)