test(jobs): clean jobs properly

This commit is contained in:
Houkime 2024-08-07 13:29:51 +00:00
parent b67777835d
commit b522c72aaf

View file

@ -1,14 +1,12 @@
from tests.common import generate_jobs_query from selfprivacy_api.jobs import Jobs
import tests.test_graphql.test_api_backup
from tests.common import generate_jobs_query
from tests.test_graphql.common import ( from tests.test_graphql.common import (
assert_ok,
assert_empty, assert_empty,
assert_errorcode,
get_data, get_data,
) )
from tests.test_jobs import jobs
from selfprivacy_api.jobs import Jobs
API_JOBS_QUERY = """ API_JOBS_QUERY = """
getJobs { getJobs {
@ -42,17 +40,17 @@ def api_jobs(authorized_client):
return result return result
def test_all_jobs_unauthorized(client): def test_all_jobs_unauthorized(client, jobs):
response = graphql_send_query(client, generate_jobs_query([API_JOBS_QUERY])) response = graphql_send_query(client, generate_jobs_query([API_JOBS_QUERY]))
assert_empty(response) assert_empty(response)
def test_all_jobs_when_none(authorized_client): def test_all_jobs_when_none(authorized_client, jobs):
output = api_jobs(authorized_client) output = api_jobs(authorized_client)
assert output == [] assert output == []
def test_all_jobs_when_some(authorized_client): def test_all_jobs_when_some(authorized_client, jobs):
# We cannot make new jobs via API, at least directly # We cannot make new jobs via API, at least directly
job = Jobs.add("bogus", "bogus.bogus", "fungus") job = Jobs.add("bogus", "bogus.bogus", "fungus")
output = api_jobs(authorized_client) output = api_jobs(authorized_client)