Skip to content

Commit

Permalink
Merge branch 'niels/add-bulk-job-test' into 'master'
Browse files Browse the repository at this point in the history
Add unit test for JobsService::bulk_launch(_fields)

See merge request qacafe/cdrouter/cdrouter.py!20
  • Loading branch information
Niels Widger committed Dec 1, 2022
2 parents c442b30 + 7940f00 commit 51b6183
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from cdrouter.cdrouter import CDRouterError
from cdrouter.cdr_datetime import DateTime
from cdrouter.filters import Field as field
from cdrouter.jobs import Job
from cdrouter.jobs import Job, Options

from .utils import my_cdrouter, my_c, import_all_from_file # pylint: disable=unused-import

Expand Down Expand Up @@ -174,6 +174,20 @@ def test_bulk_launch(self, c):

assert len(list(c.jobs.iter_list())) == 4

# bulk launch all packages matching the given filter using the
# given run_at and options job fields
c.jobs.bulk_launch(_fields=Job(
run_at=self.run_at_year_9999(),
options=Options(tags=['iamatag'], extra_cli_args='-testvar lanIp=1.1.1.1'),
), filter=[field('name').eq('example')])

jobs = list(c.jobs.iter_list())
assert len(jobs) == 5
j = jobs[4]

assert j.options.tags == ['iamatag']
assert j.options.extra_cli_args == '-testvar lanIp=1.1.1.1'

def test_bulk_delete(self, c):
import_all_from_file(c, 'tests/testdata/example2.gz')

Expand Down

0 comments on commit 51b6183

Please sign in to comment.