Skip to content

Commit de2d3b5

Browse files
committed
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWeb-Back into fix(create_light_vieawable_pointset)
2 parents d6e7a39 + 48ee99a commit de2d3b5

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/opengeodeweb_back/test_utils.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ def test_route_wrong_params(client, route, get_full_data):
1212
response = client.post(route, json=json)
1313
assert response.status_code == 400
1414
error_description = response.json["description"]
15-
assert error_description == f"Validation error: '{key}' is a required property"
15+
assert "data must contain" in error_description
16+
assert f"'{key}'" in error_description
1617

1718
json = get_full_data()
1819
json["dumb_key"] = "dumb_value"
1920
response = client.post(route, json=json)
2021
assert response.status_code == 400
2122
error_description = response.json["description"]
22-
assert (
23-
error_description
24-
== "Validation error: Additional properties are not allowed ('dumb_key' was unexpected)"
25-
)
23+
assert "data must not contain" in error_description
24+
assert "'dumb_key'" in error_description

src/opengeodeweb_back/utils_functions.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,14 @@ def validate_request(request, schema):
8787
validate(json_data)
8888
except fastjsonschema.JsonSchemaException as e:
8989
error_msg = str(e)
90-
90+
9191
if "data must contain" in error_msg:
9292
field = error_msg.split("data must contain ['")[1].split("']")[0]
9393
error_msg = f"'{field}' is a required property"
9494
elif "data must not contain" in error_msg:
9595
field = error_msg.split("data must not contain {'")[1].split("'")[0]
96-
error_msg = (
97-
f"Additional properties are not allowed ('{field}' was unexpected)"
98-
)
99-
96+
error_msg = f"Additional properties are not allowed ('{field}' was unexpected)"
97+
10098
flask.abort(400, f"Validation error: {error_msg}")
10199

102100

0 commit comments

Comments
 (0)