selfprivacy-rest-api/tests/test_graphql/test_api_version.py

26 lines
739 B
Python
Raw Normal View History

2022-06-29 17:39:46 +00:00
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
# pylint: disable=missing-function-docstring
from tests.common import generate_api_query
API_VERSION_QUERY = "version"
2022-07-07 13:53:19 +00:00
2022-06-29 17:39:46 +00:00
def test_graphql_get_api_version(authorized_client):
response = authorized_client.post(
2022-06-29 17:39:46 +00:00
"/graphql",
2022-07-07 13:53:19 +00:00
json={"query": generate_api_query([API_VERSION_QUERY])},
2022-06-29 17:39:46 +00:00
)
assert response.status_code == 200
assert "version" in response.json()["data"]["api"]
2022-06-29 17:39:46 +00:00
def test_graphql_api_version_unauthorized(client):
response = client.post(
2022-06-29 17:39:46 +00:00
"/graphql",
2022-07-07 13:53:19 +00:00
json={"query": generate_api_query([API_VERSION_QUERY])},
2022-06-29 17:39:46 +00:00
)
assert response.status_code == 200
assert "version" in response.json()["data"]["api"]