Add custom_virtualenv param to inventory source and tests

This commit is contained in:
AlanCoding
2019-10-29 16:20:30 -04:00
parent a026838f77
commit 5e24cee0ae
6 changed files with 120 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ def test_create_organization(run_module, admin_user):
module_args = {'name': 'foo', 'description': 'barfoo', 'state': 'present'}
result = run_module('tower_organization', module_args, admin_user)
assert result.get('changed'), result
org = Organization.objects.get(name='foo')
@@ -26,3 +27,26 @@ 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 == {
"organization": "foo",
"state": "present",
"id": org.id
}
assert org.custom_virtualenv == path