From 2d6406c8c1eb9f2cd8ae70c10d9ac69e0437d275 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Mon, 9 Jan 2023 12:17:36 +0000 Subject: [PATCH] test(tokens-repo): rework recovery expiration in the past --- tests/test_graphql/test_api_recovery.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/tests/test_graphql/test_api_recovery.py b/tests/test_graphql/test_api_recovery.py index 47332aa..a02b582 100644 --- a/tests/test_graphql/test_api_recovery.py +++ b/tests/test_graphql/test_api_recovery.py @@ -199,26 +199,12 @@ def test_graphql_generate_recovery_key_with_expiration_in_the_past( authorized_client, tokens_file ): expiration_date = datetime.datetime.now() - datetime.timedelta(minutes=5) - expiration_date_str = expiration_date.strftime("%Y-%m-%dT%H:%M:%S.%f") - - response = authorized_client.post( - "/graphql", - json={ - "query": API_RECOVERY_KEY_GENERATE_MUTATION, - "variables": { - "limits": { - "expirationDate": expiration_date_str, - }, - }, - }, + response = request_make_new_recovery_key( + authorized_client, expires_at=expiration_date ) - assert response.status_code == 200 - assert response.json().get("data") is not None - assert response.json()["data"]["getNewRecoveryApiKey"]["success"] is False - assert response.json()["data"]["getNewRecoveryApiKey"]["message"] is not None - assert response.json()["data"]["getNewRecoveryApiKey"]["code"] == 400 + + assert_errorcode(response, "getNewRecoveryApiKey", 400) assert response.json()["data"]["getNewRecoveryApiKey"]["key"] is None - assert "recovery_token" not in read_json(tokens_file) def test_graphql_generate_recovery_key_with_invalid_time_format(