tests: fix

This commit is contained in:
dettlaff 2023-08-07 16:56:35 +04:00
parent be8d249a04
commit a316f8b910
3 changed files with 14 additions and 12 deletions

BIN
dump.rdb

Binary file not shown.

View file

@ -6,7 +6,7 @@ from selfprivacy_api.graphql import IsAuthenticated
from selfprivacy_api.graphql.mutations.mutation_interface import ( from selfprivacy_api.graphql.mutations.mutation_interface import (
GenericMutationReturn, GenericMutationReturn,
MutationReturnInterface, MutationReturnInterface,
GenericJobButationReturn, GenericJobMutationReturn,
) )
import selfprivacy_api.actions.system as system_actions import selfprivacy_api.actions.system as system_actions
@ -131,10 +131,10 @@ class SystemMutations:
) )
@strawberry.mutation(permission_classes=[IsAuthenticated]) @strawberry.mutation(permission_classes=[IsAuthenticated])
def nix_collect_garbage(self) -> GenericJobButationReturn: def nix_collect_garbage(self) -> GenericJobMutationReturn:
job = start_nix_collect_garbage() job = start_nix_collect_garbage()
return GenericJobButationReturn( return GenericJobMutationReturn(
success=True, success=True,
code=200, code=200,
message="Cleaning started..,", message="Cleaning started..,",

View file

@ -113,11 +113,13 @@ def test_get_dead_packages_zero(job_reset):
RUN_NIX_COLLECT_GARBAGE_QUERY = """ RUN_NIX_COLLECT_GARBAGE_QUERY = """
mutation system { mutation CollectGarbage {
nixCollectGarbage { system {
success nixCollectGarbage {
message success
code message
code
}
} }
} }
""" """
@ -133,7 +135,7 @@ def test_graphql_nix_collect_garbage(authorized_client):
assert response.status_code == 200 assert response.status_code == 200
assert response.json().get("data") is not None assert response.json().get("data") is not None
assert response.json()["data"]["nixCollectGarbage"]["success"] is True assert response.json()["data"]["system"]["nixCollectGarbage"]["success"] is True
assert response.json()["data"]["nixCollectGarbage"]["message"] is not None assert response.json()["data"]["system"]["nixCollectGarbage"]["message"] is not None
assert response.json()["data"]["nixCollectGarbage"]["code"] == 200 assert response.json()["data"]["system"]["nixCollectGarbage"]["success"] == True
assert response.json()["data"]["nixCollectGarbage"]["success"] == True assert response.json()["data"]["system"]["nixCollectGarbage"]["code"] == 200