mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 01:06:43 +00:00
test(tokens-repo): use get recovery status in test of recovery use
This commit is contained in:
parent
6cb9cc6d03
commit
92b2a67479
|
@ -93,25 +93,12 @@ mutation TestUseRecoveryKey($input: UseRecoveryKeyInput!) {
|
||||||
def test_graphql_generate_recovery_key(client, authorized_client, tokens_file):
|
def test_graphql_generate_recovery_key(client, authorized_client, tokens_file):
|
||||||
key = graphql_get_new_recovery_key(authorized_client)
|
key = graphql_get_new_recovery_key(authorized_client)
|
||||||
|
|
||||||
assert read_json(tokens_file)["recovery_token"] is not None
|
status = graphql_recovery_status(authorized_client)
|
||||||
time_generated = read_json(tokens_file)["recovery_token"]["date"]
|
assert status["exists"] is True
|
||||||
assert time_generated is not None
|
assert status["valid"] is True
|
||||||
assert_recovery_recent(time_generated)
|
assert_recovery_recent(status["creationDate"])
|
||||||
# Try to get token status
|
assert status["expirationDate"] is None
|
||||||
response = authorized_client.post(
|
assert status["usesLeft"] is None
|
||||||
"/graphql",
|
|
||||||
json={"query": generate_api_query([API_RECOVERY_QUERY])},
|
|
||||||
)
|
|
||||||
assert response.status_code == 200
|
|
||||||
assert response.json().get("data") is not None
|
|
||||||
assert response.json()["data"]["api"]["recoveryKey"] is not None
|
|
||||||
assert response.json()["data"]["api"]["recoveryKey"]["exists"] is True
|
|
||||||
assert response.json()["data"]["api"]["recoveryKey"]["valid"] is True
|
|
||||||
assert response.json()["data"]["api"]["recoveryKey"][
|
|
||||||
"creationDate"
|
|
||||||
] == time_generated.replace("Z", "")
|
|
||||||
assert response.json()["data"]["api"]["recoveryKey"]["expirationDate"] is None
|
|
||||||
assert response.json()["data"]["api"]["recoveryKey"]["usesLeft"] is None
|
|
||||||
|
|
||||||
# Try to use token
|
# Try to use token
|
||||||
response = client.post(
|
response = client.post(
|
||||||
|
|
Loading…
Reference in a new issue