test(jobs): test out setting ttl

This commit is contained in:
Houkime 2023-09-22 18:13:22 +00:00 committed by Inex Code
parent 26c0a8fafe
commit ece3258c78

View file

@ -1,6 +1,7 @@
# pylint: disable=redefined-outer-name # pylint: disable=redefined-outer-name
# pylint: disable=unused-argument # pylint: disable=unused-argument
import pytest import pytest
from time import sleep
from selfprivacy_api.jobs import Jobs, JobStatus from selfprivacy_api.jobs import Jobs, JobStatus
import selfprivacy_api.jobs as jobsmodule import selfprivacy_api.jobs as jobsmodule
@ -55,6 +56,14 @@ def test_set_zeroing_ttl(jobs_with_one_job):
assert jobs_with_one_job.get_jobs() == [] assert jobs_with_one_job.get_jobs() == []
def test_not_zeroing_ttl(jobs_with_one_job):
test_job = jobs_with_one_job.get_jobs()[0]
jobs_with_one_job.set_expiration(test_job, 1)
assert len(jobs_with_one_job.get_jobs()) == 1
sleep(1.2)
assert len(jobs_with_one_job.get_jobs()) == 0
def test_jobs(jobs_with_one_job): def test_jobs(jobs_with_one_job):
jobs = jobs_with_one_job jobs = jobs_with_one_job
test_job = jobs_with_one_job.get_jobs()[0] test_job = jobs_with_one_job.get_jobs()[0]