mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 22:07:36 -02:30
Adding insights credential to tower_inventory
Fixed a spacing issue in documentation Enhanced integration test to include a block to ensure cleanup of assets
This commit is contained in:
committed by
beeankha
parent
9323156f4c
commit
2690fcec31
@@ -3,20 +3,25 @@ __metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
from awx.main.models import Inventory
|
||||
|
||||
from awx.main.models import Inventory, Credential
|
||||
from awx.main.tests.functional.conftest import insights_credential, credentialtype_insights
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_inventory_create(run_module, admin_user, organization):
|
||||
def test_inventory_create(run_module, admin_user, organization, insights_credential):
|
||||
# Create an insights credential
|
||||
|
||||
result = run_module('tower_inventory', {
|
||||
'name': 'foo-inventory',
|
||||
'organization': organization.name,
|
||||
'variables': {'foo': 'bar', 'another-foo': {'barz': 'bar2'}},
|
||||
'insights_credential': insights_credential.name,
|
||||
'state': 'present'
|
||||
}, admin_user)
|
||||
assert not result.get('failed', False), result.get('msg', result)
|
||||
|
||||
inv = Inventory.objects.get(name='foo-inventory')
|
||||
assert inv.variables == '{"foo": "bar", "another-foo": {"barz": "bar2"}}'
|
||||
assert inv.insights_credential.name == insights_credential.name
|
||||
|
||||
result.pop('module_args', None)
|
||||
result.pop('invocation', None)
|
||||
@@ -28,7 +33,6 @@ def test_inventory_create(run_module, admin_user, organization):
|
||||
|
||||
assert inv.organization_id == organization.id
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_invalid_smart_inventory_create(run_module, admin_user, organization):
|
||||
result = run_module('tower_inventory', {
|
||||
|
||||
Reference in New Issue
Block a user