mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-18 16:39:13 +00:00
test(backups): actual testfile
This commit is contained in:
parent
b04dfc6c4e
commit
f77556b60e
38
tests/test_graphql/test_api_backup.py
Normal file
38
tests/test_graphql/test_api_backup.py
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
from tests.test_graphql.test_backup import dummy_service, backups, raw_dummy_service
|
||||||
|
|
||||||
|
# from tests.common import generate_api_query
|
||||||
|
|
||||||
|
# from selfprivacy_api.graphql.mutations.backup_mutations import BackupMutations
|
||||||
|
from selfprivacy_api.jobs import Jobs, JobStatus
|
||||||
|
|
||||||
|
API_BACK_UP_MUTATION = """
|
||||||
|
mutation TestBackupService($service_id: String) {
|
||||||
|
startBackup(serviceId: $service_id) {
|
||||||
|
success
|
||||||
|
message
|
||||||
|
code
|
||||||
|
job {
|
||||||
|
uid
|
||||||
|
status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def api_backup(authorized_client, service):
|
||||||
|
response = authorized_client.post(
|
||||||
|
"/graphql",
|
||||||
|
json={
|
||||||
|
"query": API_BACK_UP_MUTATION,
|
||||||
|
"variables": {"service_id": service.get_id()},
|
||||||
|
},
|
||||||
|
).json()
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def test_start_backup(authorized_client, dummy_service):
|
||||||
|
response = api_backup(authorized_client, dummy_service)
|
||||||
|
assert response["data"]["startBackup"]["success"] is True
|
||||||
|
job = response["data"]["startBackup"]["job"]
|
||||||
|
assert Jobs.get_job(job["uid"]).status == JobStatus.FINISHED
|
Loading…
Reference in a new issue