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
parent 7b5fb4b2df
commit cb46c5e43b

View file

@ -5,11 +5,6 @@ import datetime
import pytest
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
@ -105,7 +100,8 @@ def test_refresh_token(authorized_client, tokens_file):
response = authorized_client.post("/auth/tokens")
assert response.status_code == 200
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