Compute fields in smart task_impact tests

This commit is contained in:
AlanCoding
2019-12-09 10:51:25 -05:00
parent f1b4e24833
commit dfc4a0c0e0
2 changed files with 23 additions and 3 deletions

View File

@@ -122,6 +122,22 @@ def project_playbooks():
mocked.start()
@pytest.fixture
def run_computed_fields_right_away(request):
def run_me(inventory_id, should_update_hosts=True):
i = Inventory.objects.get(id=inventory_id)
i.update_computed_fields(update_hosts=should_update_hosts)
mocked = mock.patch(
'awx.main.signals.update_inventory_computed_fields.delay',
new=run_me
)
mocked.start()
request.addfinalizer(mocked.stop)
@pytest.fixture
@mock.patch.object(Project, "update", lambda self, **kwargs: None)
def project(instance, organization):