Skip to content
Snippets Groups Projects
Commit eada76e0a3a5 authored by Arnaud Vergnet's avatar Arnaud Vergnet :sun_with_face:
Browse files

test: add binary route test invalid params type

parent 35d5208e0168
No related branches found
No related tags found
1 merge request!62tests: improve coverage
...@@ -140,6 +140,44 @@ ...@@ -140,6 +140,44 @@
"title": "OpenApiValidationError", "title": "OpenApiValidationError",
} }
def test_wrong_eid_type(self):
response = self.webapp.get(
self.get_api_path("binary"),
params={"eid": "this is wrong", "attribute": "binary"},
headers=self.custom_headers,
status=400,
).json
assert response == {
"data": [
{
"exception": "CastError",
"message": "Failed to cast value to integer type: this is wrong",
}
],
"message": "Your request could not be validated against the openapi "
"specification.",
"title": "OpenApiValidationError",
}
def test_wrong_attribute_type(self):
response = self.webapp.get(
self.get_api_path("binary"),
params={"eid": 5, "attribute": 5},
headers=self.custom_headers,
status=400,
).json
assert response == {
"data": [
{
"exception": "ValidationError",
"message": "'5' does not match '^[a-z_][a-z0-9_]+$'",
}
],
"message": "Your request could not be validated against the openapi "
"specification.",
"title": "OpenApiValidationError",
}
def test_missing_custom_headers_returns_400(self): def test_missing_custom_headers_returns_400(self):
response = self.webapp.get( response = self.webapp.get(
self.get_api_path("binary"), self.get_api_path("binary"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment