test(tokens-repo): check refreshed token validity by trying to auth

This commit is contained in:
Houkime 2022-12-28 15:43:43 +00:00 committed by Inex Code
parent 270e569af2
commit 07fe2f8a55

View file

@ -5,11 +5,6 @@ import datetime
import pytest import pytest
from mnemonic import Mnemonic from mnemonic import Mnemonic
from selfprivacy_api.repositories.tokens.json_tokens_repository import (
JsonTokensRepository,
)
TOKEN_REPO = JsonTokensRepository()
from tests.common import read_json, write_json from tests.common import read_json, write_json
@ -105,7 +100,8 @@ def test_refresh_token(authorized_client, tokens_file):
response = authorized_client.post("/auth/tokens") response = authorized_client.post("/auth/tokens")
assert response.status_code == 200 assert response.status_code == 200
new_token = response.json()["token"] new_token = response.json()["token"]
assert TOKEN_REPO.get_token_by_token_string(new_token) is not None authorized_client.headers.update({"Authorization": "Bearer " + new_token})
assert rest_get_tokens_info(authorized_client) is not None
# new device # new device