Align auth token to flask version to prevent user-logout

This commit is contained in:
Matthias
2020-12-31 10:22:28 +01:00
parent 346542e5cd
commit eb20f6e7d0
3 changed files with 6 additions and 8 deletions

View File

@@ -91,9 +91,9 @@ def test_api_not_found(botclient):
def test_api_auth():
with pytest.raises(ValueError):
create_token({'sub': 'Freqtrade'}, 'secret1234', token_type="NotATokenType")
create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234', token_type="NotATokenType")
token = create_token({'sub': 'Freqtrade'}, 'secret1234')
token = create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234')
assert isinstance(token, bytes)
u = get_user_from_token(token, 'secret1234')
@@ -101,7 +101,7 @@ def test_api_auth():
with pytest.raises(HTTPException):
get_user_from_token(token, 'secret1234', token_type='refresh')
# Create invalid token
token = create_token({'sub`': 'Freqtrade'}, 'secret1234')
token = create_token({'identity': {'u1': 'Freqrade'}}, 'secret1234')
with pytest.raises(HTTPException):
get_user_from_token(token, 'secret1234')