Skip to content

Commit 82e3aaf

Browse files
committed
Rename unit test data.json files to file_name.json
1 parent 9220be6 commit 82e3aaf

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
@@ -18,7 +18,7 @@
1818
ROOT_TO_UNIT_TESTS = CURRENT_FILE.parents[1].relative_to(CURRENT_FILE.parents[3])
1919

2020

21-
def load_test_data(script_dir: Path, data_path: str, use_subfold: bool = True) -> list:
21+
def load_test_data(script_dir: Path, file_name: str, use_subfold: bool = True) -> list:
2222
"""
2323
Load structured test data for a test file.
2424
@@ -27,7 +27,7 @@ def load_test_data(script_dir: Path, data_path: str, use_subfold: bool = True) -
2727
2828
Args:
2929
test_script_dir: Directory containing the test file.
30-
data_path: Name of the test_data folder to load.
30+
file_name: Name of the test_data folder to load.
3131
use_sub: Dive into same subfolders as script_dir in test_data
3232
3333
Returns:
@@ -55,7 +55,7 @@ def load_test_data(script_dir: Path, data_path: str, use_subfold: bool = True) -
5555
if subfolder and use_subfold:
5656
base /= subfolder
5757

58-
data_file = base / data_path / "data.json"
58+
data_file = base / f"{file_name}.json"
5959

6060
with data_file.open("r", encoding="utf-8") as f:
6161
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)