test(service): an unauthorized query
parent
b06f1a4153
commit
018a8ce248
|
@ -164,16 +164,20 @@ def api_stop_by_name(client, service_id: str) -> dict:
|
||||||
|
|
||||||
|
|
||||||
def api_all_services(authorized_client):
|
def api_all_services(authorized_client):
|
||||||
response = authorized_client.post(
|
response = api_all_services_raw(authorized_client)
|
||||||
"/graphql",
|
|
||||||
json={"query": generate_service_query([API_SERVICES_QUERY])},
|
|
||||||
)
|
|
||||||
data = get_data(response)
|
data = get_data(response)
|
||||||
result = data["services"]["allServices"]
|
result = data["services"]["allServices"]
|
||||||
assert result is not None
|
assert result is not None
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def api_all_services_raw(client):
|
||||||
|
return client.post(
|
||||||
|
"/graphql",
|
||||||
|
json={"query": generate_service_query([API_SERVICES_QUERY])},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def api_service(authorized_client, service: Service):
|
def api_service(authorized_client, service: Service):
|
||||||
id = service.get_id()
|
id = service.get_id()
|
||||||
for _service in api_all_services(authorized_client):
|
for _service in api_all_services(authorized_client):
|
||||||
|
@ -231,6 +235,14 @@ def test_stop_return_value(authorized_client, only_dummy_service):
|
||||||
assert service["status"] == ServiceStatus.INACTIVE.value
|
assert service["status"] == ServiceStatus.INACTIVE.value
|
||||||
|
|
||||||
|
|
||||||
|
def test_allservices_unauthorized(client, only_dummy_service):
|
||||||
|
dummy_service = only_dummy_service
|
||||||
|
response = api_all_services_raw(client)
|
||||||
|
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.json().get("data") is None
|
||||||
|
|
||||||
|
|
||||||
def test_start_unauthorized(client, only_dummy_service):
|
def test_start_unauthorized(client, only_dummy_service):
|
||||||
dummy_service = only_dummy_service
|
dummy_service = only_dummy_service
|
||||||
mutation_response = api_start(client, dummy_service)
|
mutation_response = api_start(client, dummy_service)
|
||||||
|
|
Loading…
Reference in New Issue