remove update_on_project_update from InventorySource

This commit is contained in:
Seth Foster
2022-05-18 17:23:08 -04:00
parent 31d8ddcf84
commit 0522233892
17 changed files with 64 additions and 367 deletions

View File

@@ -69,21 +69,21 @@ class TestJobTemplateLabelList:
class TestInventoryInventorySourcesUpdate:
@pytest.mark.parametrize(
"can_update, can_access, is_source, is_up_on_proj, expected",
"can_update, can_access, is_source, expected",
[
(True, True, "ec2", False, [{'status': 'started', 'inventory_update': 1, 'inventory_source': 1}]),
(False, True, "gce", False, [{'status': 'Could not start because `can_update` returned False', 'inventory_source': 1}]),
(True, False, "scm", True, [{'status': 'started', 'inventory_update': 1, 'inventory_source': 1}]),
(True, True, "ec2", [{'status': 'started', 'inventory_update': 1, 'inventory_source': 1}]),
(False, True, "gce", [{'status': 'Could not start because `can_update` returned False', 'inventory_source': 1}]),
(True, False, "scm", [{'status': 'started', 'inventory_update': 1, 'inventory_source': 1}]),
],
)
def test_post(self, mocker, can_update, can_access, is_source, is_up_on_proj, expected):
def test_post(self, mocker, can_update, can_access, is_source, expected):
class InventoryUpdate:
id = 1
class Project:
name = 'project'
InventorySource = namedtuple('InventorySource', ['source', 'update_on_project_update', 'pk', 'can_update', 'update', 'source_project'])
InventorySource = namedtuple('InventorySource', ['source', 'pk', 'can_update', 'update', 'source_project'])
class InventorySources(object):
def all(self):
@@ -92,7 +92,6 @@ class TestInventoryInventorySourcesUpdate:
pk=1,
source=is_source,
source_project=Project,
update_on_project_update=is_up_on_proj,
can_update=can_update,
update=lambda: InventoryUpdate,
)