def test_patch_inventory_limit_host_ignore_case(): args = ["-l", "UPPER-HOST"] args = parse_cli_args(args) nr = InitNornir( inventory={ "plugin": "nornir.plugins.inventory.simple.SimpleInventory", "options": { "host_file": f"{TEST_DIR}_test_nornir_inventory/hosts.yaml", "group_file": f"{TEST_DIR}_test_nornir_inventory/groups.yaml", }, }, logging={"enabled": False}, ) nr.inventory = patch_inventory(args, nr.inventory) assert set(nr.inventory.hosts.keys()) == {"UPPER-HOST"}
def test_patch_inventory_basic_limit_group_invalid(): args = ["-g", "eos1234"] args = parse_cli_args(args) nr = InitNornir( inventory={ "plugin": "nornir.plugins.inventory.simple.SimpleInventory", "options": { "host_file": f"{TEST_DIR}_test_nornir_inventory/hosts.yaml", "group_file": f"{TEST_DIR}_test_nornir_inventory/groups.yaml", }, }, logging={"enabled": False}, ) nr.inventory = patch_inventory(args, nr.inventory) assert set(nr.inventory.hosts.keys()) == set()