mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 09:16:51 +00:00
jobs: singlejob fixture
This commit is contained in:
parent
c21b6cb071
commit
b6eeec23cc
|
@ -6,31 +6,14 @@ from selfprivacy_api.jobs import Jobs, JobStatus
|
|||
import selfprivacy_api.jobs as jobsmodule
|
||||
|
||||
|
||||
def test_add_reset(jobs):
|
||||
test_job = jobs.add(
|
||||
type_id="test",
|
||||
name="Test job",
|
||||
description="This is a test job.",
|
||||
status=JobStatus.CREATED,
|
||||
status_text="Status text",
|
||||
progress=0,
|
||||
)
|
||||
assert jobs.get_jobs() == [test_job]
|
||||
jobs.reset()
|
||||
assert jobs.get_jobs() == []
|
||||
def test_add_reset(jobs_with_one_job):
|
||||
jobs_with_one_job.reset()
|
||||
assert jobs_with_one_job.get_jobs() == []
|
||||
|
||||
|
||||
def test_jobs(jobs):
|
||||
|
||||
test_job = jobs.add(
|
||||
type_id="test",
|
||||
name="Test job",
|
||||
description="This is a test job.",
|
||||
status=JobStatus.CREATED,
|
||||
status_text="Status text",
|
||||
progress=0,
|
||||
)
|
||||
assert jobs.get_jobs() == [test_job]
|
||||
def test_jobs(jobs_with_one_job):
|
||||
jobs = jobs_with_one_job
|
||||
test_job = jobs_with_one_job.get_jobs()[0]
|
||||
|
||||
jobs.update(
|
||||
job=test_job,
|
||||
|
@ -62,3 +45,17 @@ def jobs():
|
|||
assert j.get_jobs() == []
|
||||
yield j
|
||||
j.reset()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def jobs_with_one_job(jobs):
|
||||
test_job = jobs.add(
|
||||
type_id="test",
|
||||
name="Test job",
|
||||
description="This is a test job.",
|
||||
status=JobStatus.CREATED,
|
||||
status_text="Status text",
|
||||
progress=0,
|
||||
)
|
||||
assert jobs.get_jobs() == [test_job]
|
||||
return jobs
|
||||
|
|
Loading…
Reference in a new issue