Commit 8ee69370 authored by fabian serin's avatar fabian serin
Browse files

Test + fix for invalid id

parent 277ca80c
Pipeline #51517 passed with stages
in 11 minutes and 46 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) as e:
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