mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-10 13:03:11 +00:00
test(jobs): clean jobs properly
This commit is contained in:
parent
b67777835d
commit
b522c72aaf
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue