diff --git a/changelogs/fragments/unit_test_data.yml b/changelogs/fragments/unit_test_data.yml new file mode 100644 index 000000000..17cf75cdd --- /dev/null +++ b/changelogs/fragments/unit_test_data.yml @@ -0,0 +1,4 @@ +--- +minor_changes: + - Make the unit-test data structures more flexible. + - Remove abandoned unit-test data. diff --git a/hacking/local-test.sh b/hacking/local-test.sh index 642dc30f0..dc532b6ac 100755 --- a/hacking/local-test.sh +++ b/hacking/local-test.sh @@ -1,13 +1,30 @@ #!/usr/bin/env bash # Usage: ./hacking/local-test.sh +set -euo pipefail + +# shellcheck disable=SC2317 +cleanup_tests() { + popd >/dev/null 2>&1 || true + rm -rf "${COLLECTION_TMP_DIR}/ansible_collections" +} + +: "${COLLECTION_TMP_DIR:=.}" # Run build, which will remove previously installed versions ./hacking/build.sh # Install new built version -ansible-galaxy collection install netbox-netbox-*.tar.gz -p . +ansible-galaxy collection install netbox-netbox-*.tar.gz \ + --force \ + --collections-path "$COLLECTION_TMP_DIR" + + +trap cleanup_tests EXIT INT TERM # You can now cd into the installed version and run tests -(cd ansible_collections/netbox/netbox/ && ansible-test units -v --python 3.10 && ansible-test sanity --requirements -v --python 3.10 --skip-test pep8 plugins/) -rm -rf ansible_collections +mkdir -p "${COLLECTION_TMP_DIR}" +pushd "${COLLECTION_TMP_DIR}/ansible_collections/netbox/netbox/" >/dev/null || exit 1 +ansible-test units -v --python 3.13 +ansible-test sanity --requirements -v --python 3.13 --skip-test pep8 plugins/ + diff --git a/tests/test_data.py b/tests/test_data.py deleted file mode 100644 index e1cc73e99..000000000 --- a/tests/test_data.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright: (c) 2019, Bruno Inec (@sweenu) -# Copyright: (c) 2019, Mikhail Yohman (@FragmentedPacket) -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -import json - - -# Load test data from a json file, for a pytest parametrize -def load_test_data(path, test_path): - with open(f"{path}/test_data/{test_path}/data.json", "r") as f: - data = json.loads(f.read()) - tests = [] - for test in data: - tuple_data = tuple(test.values()) - tests.append(tuple_data) - return tests diff --git a/tests/unit/helpers/load_data.py b/tests/unit/helpers/load_data.py new file mode 100644 index 000000000..5849cb554 --- /dev/null +++ b/tests/unit/helpers/load_data.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +""" +Helper functions for loading structured test data for unit tests. + +Provides functions to locate JSON test_data files based on the +location of the test script in tests/unit/ and to return the data +as lists of tuples for use in pytest parameterization. +""" + +import json +from pathlib import Path + +CURRENT_FILE = Path(__file__).resolve() # Current file abs path +UNIT_TESTS_DIR = CURRENT_FILE.parents[1] # project_root/tests/unit +# Relative path from project root to unit tests dir - tests/unit +ROOT_TO_UNIT_TESTS = CURRENT_FILE.parents[1].relative_to(CURRENT_FILE.parents[3]) + + +def load_test_data(script_dir: Path, file_name: str, use_subfold: bool = True) -> list: + """ + Load structured test data for a test file. + + The directory structure is derived from: + tests/unit///... + + Args: + test_script_dir: Directory containing the test file. + file_name: Name of the test_data folder to load. + use_sub: Dive into same subfolders as script_dir in test_data + + Returns: + List of tuples extracted from the JSON file. + """ + try: + # Normal environments: script_dir is resolved under same path tests/unit + units_to_test_file: list = script_dir.relative_to(UNIT_TESTS_DIR).parts + except ValueError: + # Fallback for tox/CI virtual environments where path tests/unit differ + # Find the path fragment "tests/unit" and slice from there + parts = list(script_dir.parts) + try: + idx = parts.index(UNIT_TESTS_DIR.parts[-1]) # project/tests/unit/... + units_to_test_file: list = parts[idx + 1 :] + except ValueError: + # Last-resort fallback: treat as having no subfolder + units_to_test_file = () + + unit_test_dir: str = units_to_test_file[0] if len(units_to_test_file) > 0 else "" + subfolder = Path(*units_to_test_file[1:]) if len(units_to_test_file) > 1 else None + + # Build data.json path + base = ROOT_TO_UNIT_TESTS / unit_test_dir / "test_data" + if subfolder and use_subfold: + base /= subfolder + + data_file = base / f"{file_name}.json" + + with data_file.open("r", encoding="utf-8") as f: + data = json.load(f) + + return [tuple(item.values()) for item in data] diff --git a/tests/unit/inventory/test_data/data.json b/tests/unit/inventory/test_data/data.json deleted file mode 100644 index 41726270e..000000000 --- a/tests/unit/inventory/test_data/data.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "name": "disk1", - "vm_name": "test100-vm", - "size_gb": 100 - }, - { - "name": "disk2", - "vm_name": "test100-vm", - "size_gb": 200 - } -] diff --git a/tests/unit/inventory/test_data/extract_custom_fields/data.json b/tests/unit/inventory/test_data/extract_custom_fields.json similarity index 100% rename from tests/unit/inventory/test_data/extract_custom_fields/data.json rename to tests/unit/inventory/test_data/extract_custom_fields.json diff --git a/tests/unit/inventory/test_data/filter_query_parameters/data.json b/tests/unit/inventory/test_data/filter_query_parameters.json similarity index 100% rename from tests/unit/inventory/test_data/filter_query_parameters/data.json rename to tests/unit/inventory/test_data/filter_query_parameters.json diff --git a/tests/unit/inventory/test_data/get_resource_list_chunked/data.json b/tests/unit/inventory/test_data/get_resource_list_chunked.json similarity index 100% rename from tests/unit/inventory/test_data/get_resource_list_chunked/data.json rename to tests/unit/inventory/test_data/get_resource_list_chunked.json diff --git a/tests/unit/inventory/test_data/group_extractors/data.json b/tests/unit/inventory/test_data/group_extractors.json similarity index 100% rename from tests/unit/inventory/test_data/group_extractors/data.json rename to tests/unit/inventory/test_data/group_extractors.json diff --git a/tests/unit/inventory/test_data/refresh_url/data.json b/tests/unit/inventory/test_data/refresh_url.json similarity index 100% rename from tests/unit/inventory/test_data/refresh_url/data.json rename to tests/unit/inventory/test_data/refresh_url.json diff --git a/tests/unit/inventory/test_data/validate_query_parameter/data.json b/tests/unit/inventory/test_data/validate_query_parameter.json similarity index 100% rename from tests/unit/inventory/test_data/validate_query_parameter/data.json rename to tests/unit/inventory/test_data/validate_query_parameter.json diff --git a/tests/unit/inventory/test_nb_inventory.py b/tests/unit/inventory/test_nb_inventory.py index 93a59217f..6dbaca8d2 100644 --- a/tests/unit/inventory/test_nb_inventory.py +++ b/tests/unit/inventory/test_nb_inventory.py @@ -6,8 +6,8 @@ __metaclass__ = type -import os from functools import partial +from pathlib import Path from unittest.mock import Mock, call, mock_open, patch import pytest @@ -17,7 +17,9 @@ from ansible_collections.netbox.netbox.plugins.inventory.nb_inventory import ( InventoryModule, ) - from ansible_collections.netbox.netbox.tests.test_data import load_test_data + from ansible_collections.netbox.netbox.tests.unit.helpers.load_data import ( + load_test_data, + ) except ImportError: import sys @@ -27,15 +29,12 @@ sys.path.append("plugins/inventory") sys.path.append("tests") - from test_data import load_test_data + from tests.unit.helpers.load_data import load_test_data -load_relative_test_data = partial( - load_test_data, os.path.dirname(os.path.abspath(__file__)) -) +load_relative_test_data = partial(load_test_data, Path(__file__).resolve().parent) class MockInventory: - def __init__(self): self.variables = {} diff --git a/tests/unit/module_utils/fixtures/choices/circuits.json b/tests/unit/module_utils/fixtures/choices/circuits.json deleted file mode 100644 index e7f112b72..000000000 --- a/tests/unit/module_utils/fixtures/choices/circuits.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "status": [ - { - "value": "planned", - "display_name": "Planned" - }, - { - "value": "provisioning", - "display_name": "Provisioning" - }, - { - "value": "active", - "display_name": "Active" - }, - { - "value": "offline", - "display_name": "Offline" - }, - { - "value": "deprovisioning", - "display_name": "Deprovisioning" - }, - { - "value": "decommissioned", - "display_name": "Decommissioned" - } - ] -} \ No newline at end of file diff --git a/tests/unit/module_utils/fixtures/choices/device_types.json b/tests/unit/module_utils/fixtures/choices/device_types.json deleted file mode 100644 index e82964eef..000000000 --- a/tests/unit/module_utils/fixtures/choices/device_types.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "subdevice_role": [ - { - "value": "parent", - "display_name": "Parent" - }, - { - "value": "child", - "display_name": "Child" - } - ] -} \ No newline at end of file diff --git a/tests/unit/module_utils/fixtures/choices/devices.json b/tests/unit/module_utils/fixtures/choices/devices.json deleted file mode 100644 index 5bf1f2f39..000000000 --- a/tests/unit/module_utils/fixtures/choices/devices.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "face": [ - { - "value": "front", - "display_name": "Front" - }, - { - "value": "rear", - "display_name": "Rear" - } - ], - "status": [ - { - "value": "offline", - "display_name": "Offline" - }, - { - "value": "active", - "display_name": "Active" - }, - { - "value": "planned", - "display_name": "Planned" - }, - { - "value": "staged", - "display_name": "Staged" - }, - { - "value": "failed", - "display_name": "Failed" - }, - { - "value": "inventory", - "display_name": "Inventory" - }, - { - "value": "decommissioning", - "display_name": "Decommissioning" - } - ] -} \ No newline at end of file diff --git a/tests/unit/module_utils/fixtures/choices/interfaces.json b/tests/unit/module_utils/fixtures/choices/interfaces.json deleted file mode 100644 index 2bda690ff..000000000 --- a/tests/unit/module_utils/fixtures/choices/interfaces.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "type": [ - { - "value": "virtual", - "display_name": "Virtual" - }, - { - "value": "lag", - "display_name": "Link Aggregation Group (LAG)" - }, - { - "value": "100base-tx", - "display_name": "100BASE-TX (10/100ME)" - }, - { - "value": "1000base-t", - "display_name": "1000BASE-T (1GE)" - }, - { - "value": "2.5gbase-t", - "display_name": "2.5GBASE-T (2.5GE)" - }, - { - "value": "5gbase-t", - "display_name": "5GBASE-T (5GE)" - }, - { - "value": "10gbase-t", - "display_name": "10GBASE-T (10GE)" - }, - { - "value": "10gbase-cx4", - "display_name": "10GBASE-CX4 (10GE)" - }, - { - "value": "1000base-x-gbic", - "display_name": "GBIC (1GE)" - }, - { - "value": "1000base-x-sfp", - "display_name": "SFP (1GE)" - }, - { - "value": "10gbase-x-sfpp", - "display_name": "SFP+ (10GE)" - }, - { - "value": "10gbase-x-xfp", - "display_name": "XFP (10GE)" - }, - { - "value": "10gbase-x-xenpak", - "display_name": "XENPAK (10GE)" - }, - { - "value": "10gbase-x-x2", - "display_name": "X2 (10GE)" - }, - { - "value": "25gbase-x-sfp28", - "display_name": "SFP28 (25GE)" - }, - { - "value": "40gbase-x-qsfpp", - "display_name": "QSFP+ (40GE)" - }, - { - "value": "50gbase-x-sfp28", - "display_name": "QSFP28 (50GE)" - }, - { - "value": "100gbase-x-cfp", - "display_name": "CFP (100GE)" - }, - { - "value": "100gbase-x-cfp2", - "display_name": "CFP2 (100GE)" - }, - { - "value": "200gbase-x-cfp2", - "display_name": "CFP2 (200GE)" - }, - { - "value": "100gbase-x-cfp4", - "display_name": "CFP4 (100GE)" - }, - { - "value": "100gbase-x-cpak", - "display_name": "Cisco CPAK (100GE)" - }, - { - "value": "100gbase-x-qsfp28", - "display_name": "QSFP28 (100GE)" - }, - { - "value": "200gbase-x-qsfp56", - "display_name": "QSFP56 (200GE)" - }, - { - "value": "400gbase-x-qsfpdd", - "display_name": "QSFP-DD (400GE)" - }, - { - "value": "400gbase-x-osfp", - "display_name": "OSFP (400GE)" - }, - { - "value": "ieee802.11a", - "display_name": "IEEE 802.11a" - }, - { - "value": "ieee802.11g", - "display_name": "IEEE 802.11b/g" - }, - { - "value": "ieee802.11n", - "display_name": "IEEE 802.11n" - }, - { - "value": "ieee802.11ac", - "display_name": "IEEE 802.11ac" - }, - { - "value": "ieee802.11ad", - "display_name": "IEEE 802.11ad" - }, - { - "value": "ieee802.11ax", - "display_name": "IEEE 802.11ax" - }, - { - "value": "gsm", - "display_name": "GSM" - }, - { - "value": "cdma", - "display_name": "CDMA" - }, - { - "value": "lte", - "display_name": "LTE" - }, - { - "value": "sonet-oc3", - "display_name": "OC-3/STM-1" - }, - { - "value": "sonet-oc12", - "display_name": "OC-12/STM-4" - }, - { - "value": "sonet-oc48", - "display_name": "OC-48/STM-16" - }, - { - "value": "sonet-oc192", - "display_name": "OC-192/STM-64" - }, - { - "value": "sonet-oc768", - "display_name": "OC-768/STM-256" - }, - { - "value": "sonet-oc1920", - "display_name": "OC-1920/STM-640" - }, - { - "value": "sonet-oc3840", - "display_name": "OC-3840/STM-1234" - }, - { - "value": "1gfc-sfp", - "display_name": "SFP (1GFC)" - }, - { - "value": "2gfc-sfp", - "display_name": "SFP (2GFC)" - }, - { - "value": "4gfc-sfp", - "display_name": "SFP (4GFC)" - }, - { - "value": "8gfc-sfpp", - "display_name": "SFP+ (8GFC)" - }, - { - "value": "16gfc-sfpp", - "display_name": "SFP+ (16GFC)" - }, - { - "value": "32gfc-sfp28", - "display_name": "SFP28 (32GFC)" - }, - { - "value": "128gfc-sfp28", - "display_name": "QSFP28 (128GFC)" - }, - { - "value": "inifiband-sdr", - "display_name": "SDR (2 Gbps)" - }, - { - "value": "inifiband-ddr", - "display_name": "DDR (4 Gbps)" - }, - { - "value": "inifiband-qdr", - "display_name": "QDR (8 Gbps)" - }, - { - "value": "inifiband-fdr10", - "display_name": "FDR10 (10 Gbps)" - }, - { - "value": "inifiband-fdr", - "display_name": "FDR (13.5 Gbps)" - }, - { - "value": "inifiband-edr", - "display_name": "EDR (25 Gbps)" - }, - { - "value": "inifiband-hdr", - "display_name": "HDR (50 Gbps)" - }, - { - "value": "inifiband-ndr", - "display_name": "NDR (100 Gbps)" - }, - { - "value": "inifiband-xdr", - "display_name": "XDR (250 Gbps)" - }, - { - "value": "t1", - "display_name": "T1 (1.544 Mbps)" - }, - { - "value": "e1", - "display_name": "E1 (2.048 Mbps)" - }, - { - "value": "t3", - "display_name": "T3 (45 Mbps)" - }, - { - "value": "e3", - "display_name": "E3 (34 Mbps)" - }, - { - "value": "cisco-stackwise", - "display_name": "Cisco StackWise" - }, - { - "value": "cisco-stackwise-plus", - "display_name": "Cisco StackWise Plus" - }, - { - "value": "cisco-flexstack", - "display_name": "Cisco FlexStack" - }, - { - "value": "cisco-flexstack-plus", - "display_name": "Cisco FlexStack Plus" - }, - { - "value": "juniper-vcp", - "display_name": "Juniper VCP" - }, - { - "value": "extreme-summitstack", - "display_name": "Extreme SummitStack" - }, - { - "value": "extreme-summitstack-128", - "display_name": "Extreme SummitStack-128" - }, - { - "value": "extreme-summitstack-256", - "display_name": "Extreme SummitStack-256" - }, - { - "value": "extreme-summitstack-512", - "display_name": "Extreme SummitStack-512" - }, - { - "value": "other", - "display_name": "Other" - } - ], - "mode": [ - { - "value": "access", - "display_name": "Access" - }, - { - "value": "tagged", - "display_name": "Tagged" - }, - { - "value": "tagged-all", - "display_name": "Tagged (All)" - } - ] -} \ No newline at end of file diff --git a/tests/unit/module_utils/fixtures/choices/prefixes.json b/tests/unit/module_utils/fixtures/choices/prefixes.json deleted file mode 100644 index 135ce2bba..000000000 --- a/tests/unit/module_utils/fixtures/choices/prefixes.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "status": [ - { - "value": "container", - "display_name": "Container" - }, - { - "value": "active", - "display_name": "Active" - }, - { - "value": "reserved", - "display_name": "Reserved" - }, - { - "value": "deprecated", - "display_name": "Deprecated" - } - ] -} \ No newline at end of file diff --git a/tests/unit/module_utils/fixtures/choices/racks.json b/tests/unit/module_utils/fixtures/choices/racks.json deleted file mode 100644 index 3068db3da..000000000 --- a/tests/unit/module_utils/fixtures/choices/racks.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "status": [ - { - "value": "reserved", - "display_name": "Reserved" - }, - { - "value": "available", - "display_name": "Available" - }, - { - "value": "planned", - "display_name": "Planned" - }, - { - "value": "active", - "display_name": "Active" - }, - { - "value": "deprecated", - "display_name": "Deprecated" - } - ], - "type": [ - { - "value": "2-post-frame", - "display_name": "2-post frame" - }, - { - "value": "4-post-frame", - "display_name": "4-post frame" - }, - { - "value": "4-post-cabinet", - "display_name": "4-post cabinet" - }, - { - "value": "wall-frame", - "display_name": "Wall-mounted frame" - }, - { - "value": "wall-cabinet", - "display_name": "Wall-mounted cabinet" - } - ], - "width": [ - { - "value": 19, - "display_name": "19 inches" - }, - { - "value": 23, - "display_name": "23 inches" - } - ], - "outer_unit": [ - { - "value": "mm", - "display_name": "Millimeters" - }, - { - "value": "in", - "display_name": "Inches" - } - ] -} \ No newline at end of file diff --git a/tests/unit/module_utils/fixtures/choices/services.json b/tests/unit/module_utils/fixtures/choices/services.json deleted file mode 100644 index e14147a55..000000000 --- a/tests/unit/module_utils/fixtures/choices/services.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "protocol": [ - { - "value": "tcp", - "display_name": "TCP" - }, - { - "value": "udp", - "display_name": "UDP" - } - ] -} \ No newline at end of file diff --git a/tests/unit/module_utils/fixtures/choices/sites.json b/tests/unit/module_utils/fixtures/choices/sites.json deleted file mode 100644 index 636289373..000000000 --- a/tests/unit/module_utils/fixtures/choices/sites.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "status": [ - { - "value": "active", - "display_name": "Active" - }, - { - "value": "planned", - "display_name": "Planned" - }, - { - "value": "retired", - "display_name": "Retired" - } - ] -} \ No newline at end of file diff --git a/tests/unit/module_utils/fixtures/choices/virtual_machines.json b/tests/unit/module_utils/fixtures/choices/virtual_machines.json deleted file mode 100644 index d4e781e8c..000000000 --- a/tests/unit/module_utils/fixtures/choices/virtual_machines.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "status": [ - { - "value": "active", - "display_name": "Active" - }, - { - "value": "offline", - "display_name": "Offline" - }, - { - "value": "staged", - "display_name": "Staged" - } - ] -} \ No newline at end of file diff --git a/tests/unit/module_utils/fixtures/choices/vlans.json b/tests/unit/module_utils/fixtures/choices/vlans.json deleted file mode 100644 index 1f0e6765f..000000000 --- a/tests/unit/module_utils/fixtures/choices/vlans.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "status": [ - { - "value": "active", - "display_name": "Active" - }, - { - "value": "reserved", - "display_name": "Reserved" - }, - { - "value": "deprecated", - "display_name": "Deprecated" - } - ] -} \ No newline at end of file diff --git a/tests/unit/module_utils/test_netbox_base_class.py b/tests/unit/module_utils/netbox_utils/test_netbox_module.py similarity index 98% rename from tests/unit/module_utils/test_netbox_base_class.py rename to tests/unit/module_utils/netbox_utils/test_netbox_module.py index 5d259a277..da73b5c7a 100644 --- a/tests/unit/module_utils/test_netbox_base_class.py +++ b/tests/unit/module_utils/netbox_utils/test_netbox_module.py @@ -8,10 +8,9 @@ __metaclass__ = type import re -import os from functools import partial +from pathlib import Path from unittest.mock import MagicMock - import pytest try: @@ -21,7 +20,9 @@ from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import ( NetboxModule, ) - from ansible_collections.netbox.netbox.tests.test_data import load_test_data + from ansible_collections.netbox.netbox.tests.unit.helpers.load_data import ( + load_test_data, + ) MOCKER_PATCH_PATH = "ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils.NetboxModule" except ImportError: @@ -34,13 +35,11 @@ sys.path.append("tests") from netbox_dcim import NB_DEVICES from netbox_utils import NetboxModule - from test_data import load_test_data + from tests.unit.helpers.load_data import load_test_data MOCKER_PATCH_PATH = "netbox_utils.NetboxModule" -load_relative_test_data = partial( - load_test_data, os.path.dirname(os.path.abspath(__file__)) -) +load_relative_test_data = partial(load_test_data, Path(__file__).resolve().parent) @pytest.fixture diff --git a/tests/unit/module_utils/test_data/arg_spec_default/data.json b/tests/unit/module_utils/test_data/netbox_utils/arg_spec_default.json similarity index 100% rename from tests/unit/module_utils/test_data/arg_spec_default/data.json rename to tests/unit/module_utils/test_data/netbox_utils/arg_spec_default.json diff --git a/tests/unit/module_utils/test_data/build_query_params_child/data.json b/tests/unit/module_utils/test_data/netbox_utils/build_query_params_child.json similarity index 100% rename from tests/unit/module_utils/test_data/build_query_params_child/data.json rename to tests/unit/module_utils/test_data/netbox_utils/build_query_params_child.json diff --git a/tests/unit/module_utils/test_data/build_query_params_no_child/data.json b/tests/unit/module_utils/test_data/netbox_utils/build_query_params_no_child.json similarity index 100% rename from tests/unit/module_utils/test_data/build_query_params_no_child/data.json rename to tests/unit/module_utils/test_data/netbox_utils/build_query_params_no_child.json diff --git a/tests/unit/module_utils/test_data/build_query_params_user_query_params/data.json b/tests/unit/module_utils/test_data/netbox_utils/build_query_params_user_query_params.json similarity index 100% rename from tests/unit/module_utils/test_data/build_query_params_user_query_params/data.json rename to tests/unit/module_utils/test_data/netbox_utils/build_query_params_user_query_params.json diff --git a/tests/unit/module_utils/test_data/choices_id/data.json b/tests/unit/module_utils/test_data/netbox_utils/choices_id.json similarity index 100% rename from tests/unit/module_utils/test_data/choices_id/data.json rename to tests/unit/module_utils/test_data/netbox_utils/choices_id.json diff --git a/tests/unit/module_utils/test_data/find_app/data.json b/tests/unit/module_utils/test_data/netbox_utils/find_app.json similarity index 100% rename from tests/unit/module_utils/test_data/find_app/data.json rename to tests/unit/module_utils/test_data/netbox_utils/find_app.json diff --git a/tests/unit/module_utils/test_data/normalize_data/data.json b/tests/unit/module_utils/test_data/netbox_utils/normalize_data.json similarity index 100% rename from tests/unit/module_utils/test_data/normalize_data/data.json rename to tests/unit/module_utils/test_data/netbox_utils/normalize_data.json diff --git a/tests/unit/module_utils/test_data/slug/data.json b/tests/unit/module_utils/test_data/netbox_utils/slug.json similarity index 100% rename from tests/unit/module_utils/test_data/slug/data.json rename to tests/unit/module_utils/test_data/netbox_utils/slug.json