mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-03-17 03:54:47 +00:00
Jobs: fix return value of remove_by_uid
And add a test for said return value.
This commit is contained in:
parent
5c86706f4b
commit
063dfafc19
2 changed files with 12 additions and 1 deletions
|
@ -115,7 +115,9 @@ class Jobs:
|
||||||
"""
|
"""
|
||||||
r = RedisPool().get_connection()
|
r = RedisPool().get_connection()
|
||||||
key = _redis_key_from_uuid(job_uuid)
|
key = _redis_key_from_uuid(job_uuid)
|
||||||
r.delete(key)
|
if (r.exists(key)):
|
||||||
|
r.delete(key)
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -20,6 +20,15 @@ def test_minimal_update(jobs_with_one_job):
|
||||||
assert jobs.get_jobs() == [test_job]
|
assert jobs.get_jobs() == [test_job]
|
||||||
|
|
||||||
|
|
||||||
|
def test_remove_by_uid(jobs_with_one_job):
|
||||||
|
test_job = jobs_with_one_job.get_jobs()[0]
|
||||||
|
uid_str = str(test_job.uid)
|
||||||
|
|
||||||
|
assert jobs_with_one_job.remove_by_uid(uid_str)
|
||||||
|
assert jobs_with_one_job.get_jobs() == []
|
||||||
|
assert not jobs_with_one_job.remove_by_uid(uid_str)
|
||||||
|
|
||||||
|
|
||||||
def test_remove_update_nonexistent(jobs_with_one_job):
|
def test_remove_update_nonexistent(jobs_with_one_job):
|
||||||
test_job = jobs_with_one_job.get_jobs()[0]
|
test_job = jobs_with_one_job.get_jobs()[0]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue