mirror of
https://github.com/ansible/awx.git
synced 2026-05-22 08:17:39 -02:30
[last PR stuff] + Add warning if configs specified in 2 params (#5)
* Lean on API validation for tower_inventory_source arg errors used for - validating needed credential is given - missing source_project for scm sources * Add warning when config is specified in 2 places Fix up unit tests, address multiple comments re: backwards compatibility, redundant methods, etc. Update new_name and variables parameters, update unit tests
This commit is contained in:
@@ -10,18 +10,19 @@ from awx.main.models import Organization, Inventory, Group
|
||||
def test_create_group(run_module, admin_user):
|
||||
org = Organization.objects.create(name='test-org')
|
||||
inv = Inventory.objects.create(name='test-inv', organization=org)
|
||||
variables = {"ansible_network_os": "iosxr"}
|
||||
|
||||
result = run_module('tower_group', dict(
|
||||
name='Test Group',
|
||||
inventory='test-inv',
|
||||
variables='ansible_network_os: iosxr',
|
||||
variables=variables,
|
||||
state='present'
|
||||
), admin_user)
|
||||
assert result.get('changed'), result
|
||||
|
||||
group = Group.objects.get(name='Test Group')
|
||||
assert group.inventory == inv
|
||||
assert group.variables == 'ansible_network_os: iosxr'
|
||||
assert group.variables == '{"ansible_network_os": "iosxr"}'
|
||||
|
||||
result.pop('invocation')
|
||||
assert result == {
|
||||
@@ -39,13 +40,11 @@ def test_tower_group_idempotent(run_module, admin_user):
|
||||
group = Group.objects.create(
|
||||
name='Test Group',
|
||||
inventory=inv,
|
||||
variables='ansible_network_os: iosxr'
|
||||
)
|
||||
|
||||
result = run_module('tower_group', dict(
|
||||
name='Test Group',
|
||||
inventory='test-inv',
|
||||
variables='ansible_network_os: iosxr',
|
||||
state='present'
|
||||
), admin_user)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user