mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-20 11:19:15 +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
|
@ -115,7 +115,9 @@ class Jobs:
|
|||
"""
|
||||
r = RedisPool().get_connection()
|
||||
key = _redis_key_from_uuid(job_uuid)
|
||||
r.delete(key)
|
||||
if (r.exists(key)):
|
||||
r.delete(key)
|
||||
return True
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -20,6 +20,15 @@ def test_minimal_update(jobs_with_one_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):
|
||||
test_job = jobs_with_one_job.get_jobs()[0]
|
||||
|
||||
|
|
Loading…
Reference in a new issue