mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
remove custom_virtualenv support from the AWX collection and docs
This commit is contained in:
@@ -97,61 +97,6 @@ def test_create_inventory_source_multiple_orgs(run_module, admin_user):
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_create_inventory_source_with_venv(run_module, admin_user, base_inventory, mocker, project):
|
||||
path = '/var/lib/awx/venv/custom-venv/foobar13489435/'
|
||||
source_path = '/var/lib/awx/example_source_path/'
|
||||
with mocker.patch('awx.main.models.mixins.get_custom_venv_choices', return_value=[path]):
|
||||
result = run_module('tower_inventory_source', dict(
|
||||
name='foo',
|
||||
inventory=base_inventory.name,
|
||||
state='present',
|
||||
source='scm',
|
||||
source_project=project.name,
|
||||
custom_virtualenv=path,
|
||||
source_path=source_path
|
||||
), admin_user)
|
||||
assert result.pop('changed'), result
|
||||
|
||||
inv_src = InventorySource.objects.get(name='foo')
|
||||
assert inv_src.inventory == base_inventory
|
||||
result.pop('invocation')
|
||||
|
||||
assert inv_src.custom_virtualenv == path
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_custom_venv_no_op(run_module, admin_user, base_inventory, mocker, project):
|
||||
"""If the inventory source is modified, then it should not blank fields
|
||||
unrelated to the params that the user passed.
|
||||
This enforces assumptions about the behavior of the AnsibleModule
|
||||
default argument_spec behavior.
|
||||
"""
|
||||
source_path = '/var/lib/awx/example_source_path/'
|
||||
inv_src = InventorySource.objects.create(
|
||||
name='foo',
|
||||
inventory=base_inventory,
|
||||
source_project=project,
|
||||
source='scm',
|
||||
custom_virtualenv='/var/lib/awx/venv/foobar/'
|
||||
)
|
||||
# mock needed due to API behavior, not incorrect client behavior
|
||||
with mocker.patch('awx.main.models.mixins.get_custom_venv_choices', return_value=['/var/lib/awx/venv/foobar/']):
|
||||
result = run_module('tower_inventory_source', dict(
|
||||
name='foo',
|
||||
description='this is the changed description',
|
||||
inventory=base_inventory.name,
|
||||
source='scm', # is required, but behavior is arguable
|
||||
state='present',
|
||||
source_project=project.name,
|
||||
source_path=source_path
|
||||
), admin_user)
|
||||
assert result.pop('changed', None), result
|
||||
inv_src.refresh_from_db()
|
||||
assert inv_src.custom_virtualenv == '/var/lib/awx/venv/foobar/'
|
||||
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(
|
||||
|
||||
@@ -20,7 +20,6 @@ def test_create_organization(run_module, admin_user):
|
||||
'validate_certs': None,
|
||||
'tower_oauthtoken': None,
|
||||
'tower_config_file': None,
|
||||
'custom_virtualenv': None
|
||||
}
|
||||
|
||||
result = run_module('tower_organization', module_args, admin_user)
|
||||
@@ -37,24 +36,3 @@ def test_create_organization(run_module, admin_user):
|
||||
}
|
||||
|
||||
assert org.description == 'barfoo'
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_create_organization_with_venv(run_module, admin_user, mocker):
|
||||
path = '/var/lib/awx/venv/custom-venv/foobar13489435/'
|
||||
with mocker.patch('awx.main.models.mixins.get_custom_venv_choices', return_value=[path]):
|
||||
result = run_module('tower_organization', {
|
||||
'name': 'foo',
|
||||
'custom_virtualenv': path,
|
||||
'state': 'present'
|
||||
}, admin_user)
|
||||
assert result.pop('changed'), result
|
||||
|
||||
org = Organization.objects.get(name='foo')
|
||||
result.pop('invocation')
|
||||
assert result == {
|
||||
"name": "foo",
|
||||
"id": org.id
|
||||
}
|
||||
|
||||
assert org.custom_virtualenv == path
|
||||
|
||||
Reference in New Issue
Block a user