Updating tower_org to use the new tower_api format

Pass sanity and unit tests, update tests

Remove placeholder test function, convert tower_host module, fix misc typos
This commit is contained in:
John Westcott IV
2020-01-29 13:33:04 -05:00
committed by beeankha
parent c23d605a7a
commit f89061da41
14 changed files with 120 additions and 167 deletions

View File

@@ -7,7 +7,7 @@ from awx.main.models import Organization
@pytest.mark.django_db
def test_create_organization(run_converted_module, admin_user):
def test_create_organization(run_module, admin_user):
module_args = {
'name': 'foo',
@@ -23,14 +23,16 @@ def test_create_organization(run_converted_module, admin_user):
'custom_virtualenv': None
}
result = run_converted_module('tower_organization', module_args, admin_user)
result = run_module('tower_organization', module_args, admin_user)
assert result.get('changed'), result
org = Organization.objects.get(name='foo')
result.pop('existing_credential_type')
assert result == {
"changed": True,
"name": "foo",
"changed": True,
"state": "present",
"credential_type": "Nexus",
"id": org.id,
"invocation": {
"module_args": module_args
@@ -41,10 +43,10 @@ def test_create_organization(run_converted_module, admin_user):
@pytest.mark.django_db
def test_create_organization_with_venv(run_converted_module, admin_user, mocker):
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_converted_module('tower_organization', {
result = run_module('tower_organization', {
'name': 'foo',
'custom_virtualenv': path,
'state': 'present'
@@ -53,8 +55,10 @@ def test_create_organization_with_venv(run_converted_module, admin_user, mocker)
org = Organization.objects.get(name='foo')
result.pop('invocation')
result.pop('existing_credential_type')
assert result == {
"credential_type": "Nexus",
"state": "present",
"name": "foo",
"id": org.id
}