mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 15:27:47 -02:30
Further module conversion changes, unit test changes
Multiple module changes Added on_change callback Added head_endpoint Added additional error returns Respond with a try an ID message if multiple assets found by name via return_none_on_404 kwarg Diferentiated between login and logout token errors Added is_job_done method
This commit is contained in:
@@ -7,20 +7,31 @@ from awx.main.models import Organization
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_create_organization(run_module, admin_user):
|
||||
def test_create_organization(run_converted_module, admin_user):
|
||||
|
||||
module_args = {'name': 'foo', 'description': 'barfoo', 'state': 'present'}
|
||||
module_args = {
|
||||
'name': 'foo',
|
||||
'description': 'barfoo',
|
||||
'state': 'present',
|
||||
'max_hosts': '0',
|
||||
'tower_host': None,
|
||||
'tower_username': None,
|
||||
'tower_password': None,
|
||||
'validate_certs': None,
|
||||
'tower_oauthtoken': None,
|
||||
'tower_config_file': None,
|
||||
'custom_virtualenv': None
|
||||
}
|
||||
|
||||
result = run_module('tower_organization', module_args, admin_user)
|
||||
result = run_converted_module('tower_organization', module_args, admin_user)
|
||||
assert result.get('changed'), result
|
||||
|
||||
org = Organization.objects.get(name='foo')
|
||||
|
||||
assert result == {
|
||||
"organization": "foo",
|
||||
"state": "present",
|
||||
"id": org.id,
|
||||
"changed": True,
|
||||
"name": "foo",
|
||||
"id": org.id,
|
||||
"invocation": {
|
||||
"module_args": module_args
|
||||
}
|
||||
@@ -30,10 +41,10 @@ def test_create_organization(run_module, admin_user):
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_create_organization_with_venv(run_module, admin_user, mocker):
|
||||
def test_create_organization_with_venv(run_converted_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', {
|
||||
result = run_converted_module('tower_organization', {
|
||||
'name': 'foo',
|
||||
'custom_virtualenv': path,
|
||||
'state': 'present'
|
||||
@@ -44,8 +55,7 @@ def test_create_organization_with_venv(run_module, admin_user, mocker):
|
||||
result.pop('invocation')
|
||||
|
||||
assert result == {
|
||||
"organization": "foo",
|
||||
"state": "present",
|
||||
"name": "foo",
|
||||
"id": org.id
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user