mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-18 16:39:13 +00:00
Jobs: fix value access in is_busy()
Also added a test for is_busy() that highlighted this bug.
This commit is contained in:
parent
14c4ae26ab
commit
5c86706f4b
|
@ -182,7 +182,7 @@ class Jobs:
|
|||
Check if there is a job running.
|
||||
"""
|
||||
for job in Jobs.get_jobs():
|
||||
if job["status"] == JobStatus.RUNNING.value:
|
||||
if job.status == JobStatus.RUNNING:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ def test_remove_update_nonexistent(jobs_with_one_job):
|
|||
def test_jobs(jobs_with_one_job):
|
||||
jobs = jobs_with_one_job
|
||||
test_job = jobs_with_one_job.get_jobs()[0]
|
||||
assert not jobs.is_busy()
|
||||
|
||||
jobs.update(
|
||||
job=test_job,
|
||||
|
@ -44,6 +45,7 @@ def test_jobs(jobs_with_one_job):
|
|||
)
|
||||
|
||||
assert jobs.get_jobs() == [test_job]
|
||||
assert jobs.is_busy()
|
||||
|
||||
backup = jobsmodule.JOB_EXPIRATION_SECONDS
|
||||
jobsmodule.JOB_EXPIRATION_SECONDS = 0
|
||||
|
|
Loading…
Reference in a new issue