Fix test due to pyjwt2.0

This commit is contained in:
Matthias 2021-01-08 19:27:51 +01:00
parent c8df3c4730
commit 8631a54514
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ def get_user_from_token(token, secret_key: str, token_type: str = "access"):
return username
def create_token(data: dict, secret_key: str, token_type: str = "access") -> bytes:
def create_token(data: dict, secret_key: str, token_type: str = "access") -> str:
to_encode = data.copy()
if token_type == "access":
expire = datetime.utcnow() + timedelta(minutes=15)

View File

@ -93,7 +93,7 @@ def test_api_auth():
create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234', token_type="NotATokenType")
token = create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234')
assert isinstance(token, bytes)
assert isinstance(token, str)
u = get_user_from_token(token, 'secret1234')
assert u == 'Freqtrade'