Skip to content

Commit bbb48cd

Browse files
Apply prepare changes
1 parent 6a8ea64 commit bbb48cd

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

src/opengeodeweb_back/geode_objects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# Local application imports
1212

13+
1314
def geode_objects_dict():
1415
return {
1516
"BRep": {

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ def create_point():
310310
) as file:
311311
vertex_attribute_names_json = json.load(file)
312312

313+
313314
@routes.route(
314315
vertex_attribute_names_json["route"],
315316
methods=vertex_attribute_names_json["methods"],
@@ -318,8 +319,12 @@ def vertex_attribute_names():
318319

319320
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
320321
utils_functions.validate_request(flask.request, vertex_attribute_names_json)
321-
file_absolute_path = os.path.join(UPLOAD_FOLDER, werkzeug.utils.secure_filename(flask.request.json["filename"]))
322-
data = geode_functions.load(flask.request.json["input_geode_object"], file_absolute_path)
322+
file_absolute_path = os.path.join(
323+
UPLOAD_FOLDER, werkzeug.utils.secure_filename(flask.request.json["filename"])
324+
)
325+
data = geode_functions.load(
326+
flask.request.json["input_geode_object"], file_absolute_path
327+
)
323328
vertex_attribute_names = data.vertex_attribute_manager().attribute_names()
324329

325330
return flask.make_response(
@@ -330,13 +335,13 @@ def vertex_attribute_names():
330335
)
331336

332337

333-
334338
with open(
335339
os.path.join(schemas, "polygon_attribute_names.json"),
336340
"r",
337341
) as file:
338342
polygon_attribute_names_json = json.load(file)
339343

344+
340345
@routes.route(
341346
polygon_attribute_names_json["route"],
342347
methods=polygon_attribute_names_json["methods"],
@@ -345,10 +350,14 @@ def polygon_attribute_names():
345350

346351
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
347352
utils_functions.validate_request(flask.request, vertex_attribute_names_json)
348-
file_absolute_path = os.path.join(UPLOAD_FOLDER, werkzeug.utils.secure_filename(flask.request.json["filename"]))
349-
data = geode_functions.load(flask.request.json["input_geode_object"], file_absolute_path)
353+
file_absolute_path = os.path.join(
354+
UPLOAD_FOLDER, werkzeug.utils.secure_filename(flask.request.json["filename"])
355+
)
356+
data = geode_functions.load(
357+
flask.request.json["input_geode_object"], file_absolute_path
358+
)
350359
polygon_attribute_names = data.polygon_attribute_manager().attribute_names()
351-
360+
352361
return flask.make_response(
353362
{
354363
"polygon_attribute_names": polygon_attribute_names,

src/opengeodeweb_back/test_utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ def test_route_wrong_params(client, route, get_full_data):
1313
assert response.status_code == 400
1414
error_description = response.json["description"]
1515
assert error_description == f"Validation error: '{key}' is a required property"
16-
16+
1717
json = get_full_data()
1818
json["dumb_key"] = "dumb_value"
1919
response = client.post(route, json=json)
2020
assert response.status_code == 400
2121
error_description = response.json["description"]
22-
assert error_description == "Validation error: Additional properties are not allowed ('dumb_key' was unexpected)"
23-
22+
assert (
23+
error_description
24+
== "Validation error: Additional properties are not allowed ('dumb_key' was unexpected)"
25+
)

tests/test_routes.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def get_full_data():
4444
# Test all params
4545
test_utils.test_route_wrong_params(client, route, get_full_data)
4646

47+
4748
def test_upload_file(client):
4849
response = client.put(
4950
f"/upload_file",
@@ -63,7 +64,7 @@ def get_full_data():
6364
}
6465

6566
json = get_full_data()
66-
response = client.post(route,json=json)
67+
response = client.post(route, json=json)
6768
assert response.status_code == 200
6869
has_missing_files = response.json["has_missing_files"]
6970
mandatory_files = response.json["mandatory_files"]
@@ -75,6 +76,7 @@ def get_full_data():
7576
# Test all params
7677
test_utils.test_route_wrong_params(client, route, get_full_data)
7778

79+
7880
def test_geographic_coordinate_systems(client):
7981
route = f"/geographic_coordinate_systems"
8082
get_full_data = lambda: {"input_geode_object": "BRep"}
@@ -89,8 +91,9 @@ def test_geographic_coordinate_systems(client):
8991
# Test all params
9092
test_utils.test_route_wrong_params(client, route, get_full_data)
9193

94+
9295
def test_inspect_file(client):
93-
route = f"/inspect_file"
96+
route = f"/inspect_file"
9497

9598
def get_full_data():
9699
return {
@@ -109,6 +112,7 @@ def get_full_data():
109112
# Test all params
110113
test_utils.test_route_wrong_params(client, route, get_full_data)
111114

115+
112116
def test_geode_objects_and_output_extensions(client):
113117
route = "/geode_objects_and_output_extensions"
114118

@@ -159,6 +163,7 @@ def get_full_data():
159163
# Test all params
160164
test_utils.test_route_wrong_params(client, route, get_full_data)
161165

166+
162167
def test_vertex_attribute_names(client):
163168
response = client.put(
164169
f"/upload_file",
@@ -185,7 +190,6 @@ def get_full_data():
185190
test_utils.test_route_wrong_params(client, route, get_full_data)
186191

187192

188-
189193
def test_polygon_attribute_names(client):
190194
response = client.put(
191195
f"/upload_file",
@@ -225,5 +229,5 @@ def test_create_point(client):
225229
id = response.json["id"]
226230
assert type(id) is str
227231

228-
# Test all params
232+
# Test all params
229233
test_utils.test_route_wrong_params(client, route, get_full_data)

0 commit comments

Comments
 (0)