Skip to content

Commit c1d3a9b

Browse files
committed
Validate folder path in test_generate_native_viewable_and_light_viewable and update regex for file name assertions
1 parent 5605db7 commit c1d3a9b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/opengeodeweb_back/utils_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,4 @@ def generate_native_viewable_and_light_viewable(
175175
"object_type": object_type,
176176
"binary_light_viewable": str(binary_light_viewable, "utf-8"),
177177
"geode_object": geode_object,
178-
}
178+
}

tests/test_utils_functions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,18 @@ def test_generate_native_viewable_and_light_viewable():
7777
data = geode_functions.load(
7878
geode_object, os.path.join(folder_absolute_path, "test.og_brep")
7979
)
80-
folder_absolute_path = "None"
80+
if not os.path.isdir(folder_absolute_path):
81+
raise ValueError(f"Invalid folder path: {folder_absolute_path}")
82+
# folder_absolute_path = "None"
8183
result = utils_functions.generate_native_viewable_and_light_viewable(
8284
geode_object, data, folder_absolute_path
8385
)
8486
assert type(result) is dict
8587
assert type(result["name"]) is str
8688
assert type(result["native_file_name"]) is str
87-
assert re.match(r"[0-9a-f]{32}\.[a-zA-Z0-9]+", result["native_file_name"])
89+
assert re.match(r"native\.[a-zA-Z0-9]+", result["native_file_name"])
8890
assert type(result["viewable_file_name"]) is str
89-
assert re.match(r"[0-9a-f]{32}\.[a-zA-Z0-9]+", result["viewable_file_name"])
91+
assert re.match(r"viewable\.[a-zA-Z0-9]+", result["viewable_file_name"])
9092
assert type(result["id"]) is str
9193
assert re.match(r"[0-9a-f]{32}", result["id"])
9294
assert type(result["object_type"]) is str

0 commit comments

Comments
 (0)