Commit cc49a902 authored by fabian serin's avatar fabian serin
Browse files

Merge branch 'fserin/BUG_invalid_wellbore_id' into 'master'

Invalid Id given on V3 Wellbore API should return 4xx instead of 500

See merge request !171
parents 8ac809e5 fdfc0b1a
Pipeline #51700 passed with stages
in 13 minutes and 39 seconds
......@@ -48,5 +48,5 @@ class DMSV3RouterUtils:
try:
delfi_id = ConverterUtils.decode_id(entity_id)
return DMSV3RouterUtils.is_delfi_id(delfi_id), delfi_id
except ValueError as e:
except (ValueError, LookupError):
return False, None
......@@ -181,6 +181,21 @@ def test_get_record_as_OSDU(client, entity_class, base_url, source_file, record_
entity_class.validate(res)
get_invalid_id_parameters = [
(Wellbore, "/ddms/v3/wellbores", "toto"),
(Well, "/ddms/v3/wells", "schmurf"),
]
@pytest.mark.parametrize("entity_class, base_url, record_id", get_invalid_id_parameters)
def test_get_record_incorrect_id(client, entity_class, base_url, record_id):
response = client.get(
f"{base_url}/{record_id}",
headers={"data-partition-id": "testing_partition"},
)
assert response.status_code == status.HTTP_417_EXPECTATION_FAILED
@pytest.mark.parametrize("base_url, id, record_obj", tests_parameters)
def test_get_record_success(client, base_url, id, record_obj):
record_id = record_obj.id
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment