Fixing test fallout from InventorySource model change

This commit is contained in:
Wayne Witzel III
2017-04-07 00:37:12 -04:00
parent c784c96449
commit 4b5b56c284
5 changed files with 41 additions and 27 deletions

View File

@@ -342,12 +342,25 @@ def group(inventory):
@pytest.fixture
def inventory_source(group, inventory):
group.inventory = inventory
return InventorySource.objects.create(name=group.name,
def inventory_source(inventory):
return InventorySource.objects.create(name='single-inv-src',
inventory=inventory, source='gce')
@pytest.fixture
def inventory_source_factory(inventory_factory):
def invsrc(name, source=None, inventory=None):
if inventory is None:
inventory = inventory_factory("inv-is-%s" % name)
if source is None:
source = 'file'
try:
return inventory.inventory_sources.get(name=name)
except:
return inventory.inventory_sources.create(name=name, source=source)
return invsrc
@pytest.fixture
def inventory_update(inventory_source):
return InventoryUpdate.objects.create(inventory_source=inventory_source)