mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 05:17:36 -02:30
Handle not-provided falsy values in tower_inventory_source
This commit is contained in:
@@ -151,6 +151,31 @@ def test_custom_venv_no_op(run_module, admin_user, base_inventory, mocker, proje
|
||||
assert inv_src.description == 'this is the changed description'
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_falsy_value(run_module, admin_user, base_inventory):
|
||||
result = run_module('tower_inventory_source', dict(
|
||||
name='falsy-test',
|
||||
inventory=base_inventory.name,
|
||||
source='ec2',
|
||||
update_on_launch=True
|
||||
), admin_user)
|
||||
assert not result.get('failed', False), result.get('msg', result)
|
||||
assert result.get('changed', None), result
|
||||
|
||||
inv_src = InventorySource.objects.get(name='falsy-test')
|
||||
assert inv_src.update_on_launch is True
|
||||
|
||||
result = run_module('tower_inventory_source', dict(
|
||||
name='falsy-test',
|
||||
inventory=base_inventory.name,
|
||||
# source='ec2',
|
||||
update_on_launch=False
|
||||
), admin_user)
|
||||
|
||||
inv_src.refresh_from_db()
|
||||
assert inv_src.update_on_launch is False
|
||||
|
||||
|
||||
# Tests related to source-specific parameters
|
||||
#
|
||||
# We want to let the API return issues with "this doesn't support that", etc.
|
||||
|
||||
Reference in New Issue
Block a user