Skip to content

Commit db9f90e

Browse files
committed
Rename unit test data.json files to file_name.json
1 parent dce8678 commit db9f90e

17 files changed

+7
-15
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
minor_changes:
3+
- Make the unit-test data structures more flexible.
4+
- Remove abandoned unit-test data.

tests/unit/helpers/load_data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
REL_UNITS_TO_ROOT = UNIT_TESTS_DIR.relative_to(PROJECT_ROOT) # tests/unit
2020

2121

22-
def load_test_data(script_dir: Path, data_path: str, use_subfold: bool = True) -> list:
22+
def load_test_data(script_dir: Path, file_name: str, use_subfold: bool = True) -> list:
2323
"""
2424
Load structured test data for a test file.
2525
@@ -28,7 +28,7 @@ def load_test_data(script_dir: Path, data_path: str, use_subfold: bool = True) -
2828
2929
Args:
3030
test_script_dir: Directory containing the test file.
31-
data_path: Name of the test_data folder to load.
31+
file_name: Name of the test_data folder to load.
3232
use_sub: Dive into same subfolders as script_dir in test_data
3333
3434
Returns:
@@ -56,7 +56,7 @@ def load_test_data(script_dir: Path, data_path: str, use_subfold: bool = True) -
5656
if subfolder and use_subfold:
5757
base /= subfolder
5858

59-
data_file = base / data_path / "data.json"
59+
data_file = base / f"{file_name}.json"
6060

6161
with data_file.open("r", encoding="utf-8") as f:
6262
data = json.load(f)

tests/unit/inventory/test_data/data.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/unit/inventory/test_data/extract_custom_fields/data.json renamed to tests/unit/inventory/test_data/extract_custom_fields.json

File renamed without changes.

tests/unit/inventory/test_data/filter_query_parameters/data.json renamed to tests/unit/inventory/test_data/filter_query_parameters.json

File renamed without changes.

tests/unit/inventory/test_data/get_resource_list_chunked/data.json renamed to tests/unit/inventory/test_data/get_resource_list_chunked.json

File renamed without changes.

tests/unit/inventory/test_data/group_extractors/data.json renamed to tests/unit/inventory/test_data/group_extractors.json

File renamed without changes.
File renamed without changes.

tests/unit/inventory/test_data/validate_query_parameter/data.json renamed to tests/unit/inventory/test_data/validate_query_parameter.json

File renamed without changes.

tests/unit/module_utils/test_data/netbox_utils/arg_spec_default/data.json renamed to tests/unit/module_utils/test_data/netbox_utils/arg_spec_default.json

File renamed without changes.

0 commit comments

Comments
 (0)