Skip to content

Commit 64410fe

Browse files
update tests
1 parent c542eff commit 64410fe

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

tests/test_functions.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,12 @@ def test_get_inspector_children():
207207
)
208208
if geode_functions.is_loadable(geode_object, file_absolute_path):
209209
data = geode_functions.load(geode_object, file_absolute_path)
210-
inspection_result = geode_functions.inspect(geode_object, data)
211-
assert "InspectionResult" in inspection_result.__class__.__name__
212-
inspection_tree = [
213-
geode_functions.get_inspector_children(inspection_result)
214-
]
215-
print(f"\t\t{inspection_tree=}", flush=True)
216-
assert type(inspection_tree) is list
217-
assert type(inspection_tree[0]) is dict
210+
class_inspector = geode_functions.inspect(geode_object, data)
211+
assert "InspectionResult" in class_inspector.__class__.__name__
212+
inspection_result = geode_functions.get_inspector_children(class_inspector)
213+
214+
print(f"\t\t{inspection_result=}", flush=True)
215+
assert type(inspection_result) is dict
218216

219217

220218
def test_filter_geode_objects():

tests/test_routes.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def get_full_data():
2121
"filename": "corbi.og_brep",
2222
"supported_feature": None,
2323
}
24-
24+
2525
# Normal test with filename 'corbi.og_brep'
2626
response = client.post(route, json=get_full_data())
2727
assert response.status_code == 200
@@ -103,13 +103,29 @@ def test_geographic_coordinate_systems(client):
103103
def test_inspect_file(client):
104104
route = f"/inspect_file"
105105

106+
def get_full_data():
107+
return {
108+
"input_geode_object": "BRep",
109+
"filename": "corbi.og_brep",
110+
}
111+
112+
json = get_full_data()
113+
106114
# Normal test with geode_object 'BRep'
107115
response = client.post(
108-
route, json={"input_geode_object": "BRep", "filename": "corbi.og_brep"}
116+
route, json=json
109117
)
110118
assert response.status_code == 200
111119
inspection_result = response.json["inspection_result"]
112-
assert type(inspection_result) is list
120+
assert type(inspection_result) is dict
121+
122+
for key, value in get_full_data().items():
123+
json = get_full_data()
124+
json.pop(key)
125+
response = client.post(route, json=json)
126+
assert response.status_code == 400
127+
error_description = response.json["description"]
128+
assert error_description == f"Validation error: '{key}' is a required property"
113129

114130

115131
def test_geode_objects_and_output_extensions(client):

0 commit comments

Comments
 (0)