diff options
| author | Selwin Ong <selwin.ong@gmail.com> | 2019-04-14 18:18:34 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-14 18:18:34 +0700 |
| commit | 7021cedaf9614143ddc0d8bbfb0c75f9301c7f47 (patch) | |
| tree | e4c567fa04cf0c1e711d533936201e2c67c51239 /tests/test_job.py | |
| parent | 07317b62f38b96585f86e8df090938cfc2c2ace3 (diff) | |
| download | rq-7021cedaf9614143ddc0d8bbfb0c75f9301c7f47.tar.gz | |
Implemented Job.fetch_many (#1072)
Diffstat (limited to 'tests/test_job.py')
| -rw-r--r-- | tests/test_job.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_job.py b/tests/test_job.py index 4e34574..a990dd7 100644 --- a/tests/test_job.py +++ b/tests/test_job.py @@ -183,6 +183,23 @@ class TestJob(RQTestCase): self.assertEqual(job.kwargs, dict(z=2)) self.assertEqual(job.created_at, datetime(2012, 2, 7, 22, 13, 24, 123456)) + def test_fetch_many(self): + """Fetching many jobs at once.""" + data = { + 'func': fixtures.some_calculation, + 'args': (3, 4), + 'kwargs': dict(z=2), + 'connection': self.testconn, + } + job = Job.create(**data) + job.save() + + job2 = Job.create(**data) + job2.save() + + jobs = Job.fetch_many([job.id, job2.id, 'invalid_id'], self.testconn) + self.assertEqual(jobs, [job, job2, None]) + def test_persistence_of_empty_jobs(self): # noqa """Storing empty jobs.""" job = Job() |
