Commit a960bafd authored by Luc Yriarte's avatar Luc Yriarte
Browse files

Moved urn decode tests

parent 63077d24
Pipeline #48653 failed with stages
in 22 minutes and 39 seconds
...@@ -19,3 +19,21 @@ import uuid ...@@ -19,3 +19,21 @@ import uuid
def test_bulk_id_is_an_uuid(): def test_bulk_id_is_an_uuid():
uuid.UUID(BulkId.new_bulk_id()) uuid.UUID(BulkId.new_bulk_id())
# urn decode test
def test_decode_urn_no_prefix():
uuid, prefix = BulkId.bulk_urn_decode("urn:uuid:489768d2-eee1-4a8f-ae95-7b0c30b0dcd8")
assert uuid == "489768d2-eee1-4a8f-ae95-7b0c30b0dcd8"
assert prefix is None
def test_decode_urn_with_prefix():
uuid, prefix = BulkId.bulk_urn_decode("urn:myprefix:uuid:489768d2-eee1-4a8f-ae95-7b0c30b0dcd8")
assert uuid == "489768d2-eee1-4a8f-ae95-7b0c30b0dcd8"
assert prefix == 'myprefix'
def test_decode_urn_none():
uuid = None
try:
uuid, prefix = BulkId.bulk_urn_decode(None)
except ValueError:
pass
assert uuid is None
\ No newline at end of file
...@@ -23,7 +23,6 @@ from fastapi import Header, status ...@@ -23,7 +23,6 @@ from fastapi import Header, status
from odes_storage.models import CreateUpdateRecordsResponse, Record from odes_storage.models import CreateUpdateRecordsResponse, Record
from app.bulk_persistence import BulkId
from app.model.osdu_model import Wellbore, Well from app.model.osdu_model import Wellbore, Well
from app.clients import SearchServiceClient, StorageRecordServiceClient from app.clients import SearchServiceClient, StorageRecordServiceClient
...@@ -200,22 +199,3 @@ def test_get_record_success(client, base_url, id, record_obj): ...@@ -200,22 +199,3 @@ def test_get_record_success(client, base_url, id, record_obj):
# assert it validates the input object schema # assert it validates the input object schema
record_obj.validate(response.json()) record_obj.validate(response.json())
# urn decode test
def test_decode_urn_no_prefix():
uuid, prefix = BulkId.bulk_urn_decode("urn:uuid:489768d2-eee1-4a8f-ae95-7b0c30b0dcd8")
assert uuid == "489768d2-eee1-4a8f-ae95-7b0c30b0dcd8"
assert prefix is None
def test_decode_urn_with_prefix():
uuid, prefix = BulkId.bulk_urn_decode("urn:myprefix:uuid:489768d2-eee1-4a8f-ae95-7b0c30b0dcd8")
assert uuid == "489768d2-eee1-4a8f-ae95-7b0c30b0dcd8"
assert prefix == 'myprefix'
def test_decode_urn_none():
uuid = None
try:
uuid, prefix = BulkId.bulk_urn_decode(None)
except ValueError:
pass
assert uuid is None
\ No newline at end of file
Supports Markdown
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