mirror of
https://github.com/ansible/awx.git
synced 2026-08-05 12:30:02 -02:30
fixup return values for bulk launch and host create in awxkit
Enabled the params bulk job make black make black again Fixed inventory and organization input params for bulk modules add collection integration tests Fix cli return errors fix test completeness
This commit is contained in:
42
awx_collection/test/awx/test_bulk.py
Normal file
42
awx_collection/test/awx/test_bulk.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
from awx.main.models import WorkflowJob
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_bulk_job_launch(run_module, admin_user, job_template):
|
||||
jobs = [dict(unified_job_template=job_template.id)]
|
||||
result = run_module(
|
||||
'bulk_job_launch',
|
||||
{
|
||||
'name': "foo-bulk-job",
|
||||
'jobs': jobs,
|
||||
'extra_vars': {'animal': 'owl'},
|
||||
'limit': 'foo',
|
||||
'wait': False,
|
||||
},
|
||||
admin_user,
|
||||
)
|
||||
|
||||
bulk_job = WorkflowJob.objects.get(name="foo-bulk-job")
|
||||
assert bulk_job.extra_vars == '{"animal": "owl"}'
|
||||
assert bulk_job.limit == "foo"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_bulk_host_create(run_module, admin_user, inventory):
|
||||
hosts = [dict(name="127.0.0.1"), dict(name="foo.dns.org")]
|
||||
result = run_module(
|
||||
'bulk_host_create',
|
||||
{
|
||||
'inventory': inventory.id,
|
||||
'hosts': hosts,
|
||||
},
|
||||
admin_user,
|
||||
)
|
||||
resp_hosts = inventory.hosts.all().values_list('name', flat=True)
|
||||
for h in hosts:
|
||||
assert h['name'] in resp_hosts
|
||||
Reference in New Issue
Block a user