def test_collect_layouts_dependencies(self, id_set): """ Given - A layout entry in the id_set. When - Building dependency graph for pack. Then - Extracting the packs that the layout depends on. """ expected_result = {("FeedMitreAttack", True), ("PrismaCloudCompute", True), ("CommonTypes", True), ("CrisisManagement", True)} test_input = [{ "Dummy Layout": { "typeID": "dummy_layout", "name": "Dummy Layout", "pack": "dummy_pack", "kind": "edit", "path": "dummy_path", "incident_and_indicator_types": ["MITRE ATT&CK", "Prisma Cloud Compute Cloud Discovery"], "incident_and_indicator_fields": ["indicator_adminname", "indicator_jobtitle"] } }] found_result = PackDependencies._collect_layouts_dependencies( pack_layouts=test_input, id_set=id_set, verbose_file=VerboseFile(), ) assert IsEqualFunctions.is_sets_equal(found_result, expected_result)
def test_collect_layouts_dependencies_filter_toversion(self, id_set): """ Given - A layout entry in the id_set. When - Building dependency graph for pack. Then - Extracting the packs that the layout depends on. - Should ignore the NonSupported pack due to toversion settings of both indicator type and field. """ expected_result = {("CommonTypes", True)} test_input = [ { "Dummy Layout": { "typeID": "dummy_layout", "name": "Dummy Layout", "pack": "dummy_pack", "kind": "edit", "path": "dummy_path", "incident_and_indicator_types": [ "accountRep", ], "incident_and_indicator_fields": [ "indicator_tags", ] } } ] found_result = PackDependencies._collect_layouts_dependencies(pack_layouts=test_input, id_set=id_set, verbose_file=VerboseFile(), exclude_ignored_dependencies=False, ) assert IsEqualFunctions.is_sets_equal(found_result, expected_result)