Skip to content
Snippets Groups Projects
Commit c0d4e7e1 authored by Yannick's avatar Yannick
Browse files

fix wellbore marker and trajectory examples

add tests around model examples + add fixture to use them in unit tests

factorize load file contents

call validate to check the fixture and fix well is V100 not V110
parent d7db8671
No related branches found
No related tags found
1 merge request!473Fix and test examples
Pipeline #102575 passed with warnings
{
{
"acl": {
"owners": [
"data.default.owners@{{datapartitionid}}.{{domain}}"
],
"viewers": [
"data.default.viewers@{{datapartitionid}}.{{domain}}"
]
"owners": [
"data.default.owners@{{datapartitionid}}.{{domain}}"
],
"viewers": [
"data.default.viewers@{{datapartitionid}}.{{domain}}"
]
},
"ancestry": {
"parents": []
"parents": []
},
"createTime": "2020-12-16T11:46:20.163Z",
"createUser": "some-user@some-company-cloud.com",
"data": {
"Artefacts": [
{
"ResourceID": "string",
"ResourceKind": "string",
"RoleID": "string"
}
],
"AuthorIDs": [
"string"
],
"AvailableMarkerProperties": [
{
"MarkerPropertyTypeID": "partition-id:reference-data--MarkerPropertyType:MissingThickness:",
"MarkerPropertyUnitID": "partition-id:reference-data--UnitOfMeasure:ft:",
"Name": "MissingThickness"
}
],
"BusinessActivities": [
"string"
],
"CreationDateTime": "2021-12-02T15:19:19.271Z",
"Datasets": [
"string"
],
"Description": "string",
"ExistenceKind": "string",
"ExtensionProperties": {},
"GeoContexts": [
"string"
],
"IsDiscoverable": true,
"IsExtendedLoad": true,
"LineageAssertions": [
{
"ID": "string",
"LineageRelationshipType": "string"
}
],
"Markers": [
{
"FeatureName": "string",
"FeatureTypeID": "string",
"GeologicalAge": "string",
"MarkerDate": "2021-12-02T15:19:19.271Z",
"MarkerInterpreter": "string",
"MarkerMeasuredDepth": 0,
"MarkerName": "string",
"MarkerObservationNumber": 0,
"MarkerSubSeaVerticalDepth": 0,
"MarkerTypeID": "string",
"Missing": "string",
"NegativeVerticalDelta": 0,
"PositiveVerticalDelta": 0,
"SurfaceDipAngle": 0,
"SurfaceDipAzimuth": 0
}
],
"Name": "string",
"ResourceCurationStatus": "string",
"ResourceHomeRegionID": "string",
"ResourceHostRegionIDs": [
"string"
],
"ResourceLifecycleStatus": "string",
"ResourceSecurityClassification": "string",
"Source": "string",
"SpatialArea": "string",
"SpatialPoint": "string",
"SubmitterName": "string",
"Tags": [
"string"
],
"VerticalMeasurement": "string",
"WellboreID": "string"
},
"id": "namespace:work-product-component--WellboreMarkerSet:d5303b79-7904-5bfe-9c44-9a3ff41b6d6c",
"kind": "osdu:wks:work-product-component--WellboreMarkerSet:1.1.0",
"legal": {
......@@ -98,13 +23,292 @@
"FR", "US"
]
},
"meta": [
"string"
"meta": [{
"kind": "Unit",
"name": "m",
"persistableReference": "{\"abcd\":{\"a\":0.0,\"b\":1.0,\"c\":1.0,\"d\":0.0},\"symbol\":\"m\",\"baseMeasurement\":{\"ancestry\":\"L\",\"type\":\"UM\"},\"type\":\"UAD\"}",
"unitOfMeasureID": "namespace:reference-data--UnitOfMeasure:m:",
"propertyNames": [
"VerticalMeasurement.VerticalMeasurement",
"Markers[].MarkerMeasuredDepth",
"Markers[].MarkerSubSeaVerticalDepth",
"Markers[].PositiveVerticalDelta",
"Markers[].NegativeVerticalDelta"
]
}, {
"kind": "Unit",
"name": "rad",
"persistableReference": "{\"abcd\":{\"a\":0.0,\"b\":1.0,\"c\":1.0,\"d\":0.0},\"symbol\":\"rad\",\"baseMeasurement\":{\"ancestry\":\"A\",\"type\":\"UM\"},\"type\":\"UAD\"}",
"unitOfMeasureID": "namespace:reference-data--UnitOfMeasure:rad:",
"propertyNames": [
"Markers[].SurfaceDipAngle",
"Markers[].SurfaceDipAzimuth"
]
}
],
"modifyTime": "2020-12-16T11:52:24.477Z",
"modifyUser": "some-user@some-company-cloud.com",
"tags": {
"NameOfKey": "String value"
"NameOfKey": "String value"
},
"version": 1562066009929332
}
\ No newline at end of file
"data": {
"ResourceHomeRegionID": "namespace:reference-data--OSDURegion:AWSEastUSA:",
"ResourceHostRegionIDs": [
"namespace:reference-data--OSDURegion:AWSEastUSA:"
],
"ResourceCurationStatus": "namespace:reference-data--ResourceCurationStatus:CREATED:",
"ResourceLifecycleStatus": "namespace:reference-data--ResourceLifecycleStatus:LOADING:",
"ResourceSecurityClassification": "namespace:reference-data--ResourceSecurityClassification:RESTRICTED:",
"Source": "Example Data Source",
"ExistenceKind": "namespace:reference-data--ExistenceKind:Prototype:",
"TechnicalAssuranceID": "namespace:reference-data--TechnicalAssuranceType:Certified:",
"Datasets": [
"namespace:dataset--AnyDataset:SomeUniqueAnyDatasetID:"
],
"Artefacts": [{
"RoleID": "namespace:reference-data--ArtefactRole:AdaptedContent:",
"ResourceKind": "namespace:source_name:group_type--IndividualType:0.0.0",
"ResourceID": "namespace:dataset--AnyDataset:SomeUniqueAnyDatasetID:"
}
],
"IsExtendedLoad": true,
"IsDiscoverable": true,
"Name": "Example Name",
"Description": "Example Description",
"CreationDateTime": "2020-02-13T09:13:15.55Z",
"Tags": [
"Example Tags"
],
"SpatialPoint": {
"SpatialLocationCoordinatesDate": "2020-02-13T09:13:15.55Z",
"QuantitativeAccuracyBandID": "namespace:reference-data--QuantitativeAccuracyBand:Length.LessThan1m:",
"QualitativeSpatialAccuracyTypeID": "namespace:reference-data--QualitativeSpatialAccuracyType:Confirmed:",
"CoordinateQualityCheckPerformedBy": "Example CoordinateQualityCheckPerformedBy",
"CoordinateQualityCheckDateTime": "2020-02-13T09:13:15.55Z",
"CoordinateQualityCheckRemarks": [
"Example CoordinateQualityCheckRemarks"
],
"AsIngestedCoordinates": {
"type": "AnyCrsFeatureCollection",
"CoordinateReferenceSystemID": "namespace:reference-data--CoordinateReferenceSystem:BoundProjected:EPSG::32021_EPSG::15851:",
"VerticalCoordinateReferenceSystemID": "namespace:reference-data--CoordinateReferenceSystem:Vertical:EPSG::5714:",
"persistableReferenceCrs": "{\"authCode\":{\"auth\":\"OSDU\",\"code\":\"32021079\"},\"lateBoundCRS\":{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"32021\"},\"name\":\"NAD_1927_StatePlane_North_Dakota_South_FIPS_3302\",\"type\":\"LBC\",\"ver\":\"PE_10_9_1\",\"wkt\":\"PROJCS[\\\"NAD_1927_StatePlane_North_Dakota_South_FIPS_3302\\\",GEOGCS[\\\"GCS_North_American_1927\\\",DATUM[\\\"D_North_American_1927\\\",SPHEROID[\\\"Clarke_1866\\\",6378206.4,294.9786982]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],PROJECTION[\\\"Lambert_Conformal_Conic\\\"],PARAMETER[\\\"False_Easting\\\",2000000.0],PARAMETER[\\\"False_Northing\\\",0.0],PARAMETER[\\\"Central_Meridian\\\",-100.5],PARAMETER[\\\"Standard_Parallel_1\\\",46.18333333333333],PARAMETER[\\\"Standard_Parallel_2\\\",47.48333333333333],PARAMETER[\\\"Latitude_Of_Origin\\\",45.66666666666666],UNIT[\\\"Foot_US\\\",0.3048006096012192],AUTHORITY[\\\"EPSG\\\",32021]]\"},\"name\":\"NAD27 * OGP-Usa Conus / North Dakota CS27 South zone [32021,15851]\",\"singleCT\":{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"15851\"},\"name\":\"NAD_1927_To_WGS_1984_79_CONUS\",\"type\":\"ST\",\"ver\":\"PE_10_9_1\",\"wkt\":\"GEOGTRAN[\\\"NAD_1927_To_WGS_1984_79_CONUS\\\",GEOGCS[\\\"GCS_North_American_1927\\\",DATUM[\\\"D_North_American_1927\\\",SPHEROID[\\\"Clarke_1866\\\",6378206.4,294.9786982]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137.0,298.257223563]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],METHOD[\\\"NADCON\\\"],PARAMETER[\\\"Dataset_conus\\\",0.0],OPERATIONACCURACY[5.0],AUTHORITY[\\\"EPSG\\\",15851]]\"},\"type\":\"EBC\",\"ver\":\"PE_10_9_1\"}",
"persistableReferenceVerticalCrs": "{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"5714\"},\"name\":\"MSL_Height\",\"type\":\"LBC\",\"ver\":\"PE_10_9_1\",\"wkt\":\"VERTCS[\\\"MSL_Height\\\",VDATUM[\\\"Mean_Sea_Level\\\"],PARAMETER[\\\"Vertical_Shift\\\",0.0],PARAMETER[\\\"Direction\\\",1.0],UNIT[\\\"Meter\\\",1.0],AUTHORITY[\\\"EPSG\\\",5714]]\"}",
"persistableReferenceUnitZ": "{\"scaleOffset\":{\"scale\":1.0,\"offset\":0.0},\"symbol\":\"m\",\"baseMeasurement\":{\"ancestry\":\"Length\",\"type\":\"UM\"},\"type\":\"USO\"}",
"features": [{
"type": "AnyCrsFeature",
"properties": {},
"geometry": {
"type": "AnyCrsPoint",
"coordinates": [
12345.6,
12345.6
],
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
},
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
}
],
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
},
"Wgs84Coordinates": {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
12345.6,
12345.6
],
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
},
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
}
],
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
},
"AppliedOperations": [
"conversion from ED_1950_UTM_Zone_31N to GCS_European_1950; 1 points converted",
"transformation GCS_European_1950 to GCS_WGS_1984 using ED_1950_To_WGS_1984_24; 1 points successfully transformed"
],
"SpatialParameterTypeID": "namespace:reference-data--SpatialParameterType:Outline:",
"SpatialGeometryTypeID": "namespace:reference-data--SpatialGeometryType:Point:"
},
"SpatialArea": {
"SpatialLocationCoordinatesDate": "2020-02-13T09:13:15.55Z",
"QuantitativeAccuracyBandID": "namespace:reference-data--QuantitativeAccuracyBand:Length.LessThan1m:",
"QualitativeSpatialAccuracyTypeID": "namespace:reference-data--QualitativeSpatialAccuracyType:Confirmed:",
"CoordinateQualityCheckPerformedBy": "Example CoordinateQualityCheckPerformedBy",
"CoordinateQualityCheckDateTime": "2020-02-13T09:13:15.55Z",
"CoordinateQualityCheckRemarks": [
"Example CoordinateQualityCheckRemarks"
],
"AsIngestedCoordinates": {
"type": "AnyCrsFeatureCollection",
"CoordinateReferenceSystemID": "namespace:reference-data--CoordinateReferenceSystem:BoundProjected:EPSG::32021_EPSG::15851:",
"VerticalCoordinateReferenceSystemID": "namespace:reference-data--CoordinateReferenceSystem:Vertical:EPSG::5714:",
"persistableReferenceCrs": "{\"authCode\":{\"auth\":\"OSDU\",\"code\":\"32021079\"},\"lateBoundCRS\":{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"32021\"},\"name\":\"NAD_1927_StatePlane_North_Dakota_South_FIPS_3302\",\"type\":\"LBC\",\"ver\":\"PE_10_9_1\",\"wkt\":\"PROJCS[\\\"NAD_1927_StatePlane_North_Dakota_South_FIPS_3302\\\",GEOGCS[\\\"GCS_North_American_1927\\\",DATUM[\\\"D_North_American_1927\\\",SPHEROID[\\\"Clarke_1866\\\",6378206.4,294.9786982]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],PROJECTION[\\\"Lambert_Conformal_Conic\\\"],PARAMETER[\\\"False_Easting\\\",2000000.0],PARAMETER[\\\"False_Northing\\\",0.0],PARAMETER[\\\"Central_Meridian\\\",-100.5],PARAMETER[\\\"Standard_Parallel_1\\\",46.18333333333333],PARAMETER[\\\"Standard_Parallel_2\\\",47.48333333333333],PARAMETER[\\\"Latitude_Of_Origin\\\",45.66666666666666],UNIT[\\\"Foot_US\\\",0.3048006096012192],AUTHORITY[\\\"EPSG\\\",32021]]\"},\"name\":\"NAD27 * OGP-Usa Conus / North Dakota CS27 South zone [32021,15851]\",\"singleCT\":{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"15851\"},\"name\":\"NAD_1927_To_WGS_1984_79_CONUS\",\"type\":\"ST\",\"ver\":\"PE_10_9_1\",\"wkt\":\"GEOGTRAN[\\\"NAD_1927_To_WGS_1984_79_CONUS\\\",GEOGCS[\\\"GCS_North_American_1927\\\",DATUM[\\\"D_North_American_1927\\\",SPHEROID[\\\"Clarke_1866\\\",6378206.4,294.9786982]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137.0,298.257223563]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],METHOD[\\\"NADCON\\\"],PARAMETER[\\\"Dataset_conus\\\",0.0],OPERATIONACCURACY[5.0],AUTHORITY[\\\"EPSG\\\",15851]]\"},\"type\":\"EBC\",\"ver\":\"PE_10_9_1\"}",
"persistableReferenceVerticalCrs": "{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"5714\"},\"name\":\"MSL_Height\",\"type\":\"LBC\",\"ver\":\"PE_10_9_1\",\"wkt\":\"VERTCS[\\\"MSL_Height\\\",VDATUM[\\\"Mean_Sea_Level\\\"],PARAMETER[\\\"Vertical_Shift\\\",0.0],PARAMETER[\\\"Direction\\\",1.0],UNIT[\\\"Meter\\\",1.0],AUTHORITY[\\\"EPSG\\\",5714]]\"}",
"persistableReferenceUnitZ": "{\"scaleOffset\":{\"scale\":1.0,\"offset\":0.0},\"symbol\":\"m\",\"baseMeasurement\":{\"ancestry\":\"Length\",\"type\":\"UM\"},\"type\":\"USO\"}",
"features": [{
"type": "AnyCrsFeature",
"properties": {},
"geometry": {
"type": "AnyCrsPoint",
"coordinates": [
12345.6,
12345.6
],
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
},
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
}
],
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
},
"Wgs84Coordinates": {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
12345.6,
12345.6
],
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
},
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
}
],
"bbox": [
12345.6,
12345.6,
12345.6,
12345.6
]
},
"AppliedOperations": [
"conversion from ED_1950_UTM_Zone_31N to GCS_European_1950; 1 points converted",
"transformation GCS_European_1950 to GCS_WGS_1984 using ED_1950_To_WGS_1984_24; 1 points successfully transformed"
],
"SpatialParameterTypeID": "namespace:reference-data--SpatialParameterType:Outline:",
"SpatialGeometryTypeID": "namespace:reference-data--SpatialGeometryType:Point:"
},
"GeoContexts": [{
"BasinID": "namespace:master-data--Basin:SomeUniqueBasinID:",
"GeoTypeID": "namespace:reference-data--BasinType:ArcWrenchOceanContinent:"
}
],
"SubmitterName": "Example SubmitterName",
"BusinessActivities": [
"Example BusinessActivities"
],
"AuthorIDs": [
"Example AuthorIDs"
],
"LineageAssertions": [{
"ID": "namespace:any-group-type--AnyIndividualType:SomeUniqueAnyIndividualTypeID:",
"LineageRelationshipType": "namespace:reference-data--LineageRelationshipType:Direct:"
}
],
"WellboreID": "namespace:master-data--Wellbore:SomeUniqueWellboreID:",
"VerticalMeasurement": {
"EffectiveDateTime": "2020-02-13T09:13:15.55Z",
"VerticalMeasurement": 12345.6,
"TerminationDateTime": "2020-02-13T09:13:15.55Z",
"VerticalMeasurementTypeID": "namespace:reference-data--VerticalMeasurementType:PBD:",
"VerticalMeasurementPathID": "namespace:reference-data--VerticalMeasurementPath:MD:",
"VerticalMeasurementSourceID": "namespace:reference-data--VerticalMeasurementSource:DRL:",
"WellboreTVDTrajectoryID": "namespace:work-product-component--WellboreTrajectory:WellboreTrajectory-911bb71f-06ab-4deb-8e68-b8c9229dc76b:",
"VerticalMeasurementUnitOfMeasureID": "namespace:reference-data--UnitOfMeasure:m:",
"VerticalCRSID": "namespace:reference-data--CoordinateReferenceSystem:BoundProjected:EPSG::32021_EPSG::15851:",
"VerticalReferenceID": "Example VerticalReferenceID",
"VerticalMeasurementDescription": "Example VerticalMeasurementDescription"
},
"AvailableMarkerProperties": [{
"MarkerPropertyTypeID": "partition-id:reference-data--MarkerPropertyType:MissingThickness:",
"MarkerPropertyUnitID": "partition-id:reference-data--UnitOfMeasure:ft:",
"Name": "MissingThickness"
}
],
"Markers": [{
"MarkerName": "Example MarkerName",
"MarkerMeasuredDepth": 12345.6,
"MarkerSubSeaVerticalDepth": 12345.6,
"MarkerDate": "2020-02-13T09:13:15.55Z",
"MarkerObservationNumber": 12345.6,
"MarkerInterpreter": "Example MarkerInterpreter",
"MarkerTypeID": "namespace:reference-data--MarkerType:BioStratigraphy:",
"FeatureTypeID": "namespace:reference-data--FeatureType:Base:",
"FeatureName": "Example FeatureName",
"PositiveVerticalDelta": 12345.6,
"NegativeVerticalDelta": 12345.6,
"SurfaceDipAngle": 12345.6,
"SurfaceDipAzimuth": 12345.6,
"Missing": "Example Missing",
"GeologicalAge": "Example GeologicalAge"
}
],
"ExtensionProperties": {}
}
}
This diff is collapsed.
......@@ -145,7 +145,7 @@ async def get_osdu_wellboreTrajectory_version(
},
)
async def post_wellboreTrajectory_osdu(
wellboretrajectories: List[WellboreTrajectory] = Body(..., example=load_schema_example("wellbore_v3.json")),
wellboretrajectories: List[WellboreTrajectory] = Body(..., example=load_schema_example("trajectory_v3.json")),
ctx: Context = Depends(get_ctx), bulk_uri_access: BulkIdAccess = Depends(get_bulk_id_access)
) -> CreateUpdateRecordsResponse:
DMSV3RouterUtils.validate_record_against_kinds_schema(wellboretrajectories)
......
This diff is collapsed.
......@@ -28,8 +28,11 @@ from hypothesis import settings, Verbosity, HealthCheck
from .data import (
well_v2_file_contents, well_v3_file_contents, wellbore_v2_file_contents, wellbore_v3_file_contents,
marker_v3_file_contents, trajectory_v3_file_contents, welllog_v3_file_contents,
domain, data_partition, legal_tags,
well_v2_record_list, well_v3_record_list, wellbore_v2_record_list, wellbore_v3_record_list,
marker_v3_record_list, trajectory_v3_record_list, welllog_v3_record_list,
well100_v3_list, wellbore100_v3_list, welllog110_v3_list, marker110_v3_list, trajectory110_v3_list,
well_wks_record, well_wks_mini_record, wellbore_wks_record, wellbore_wks_mini_record
)
......
......@@ -6,8 +6,28 @@ import json
from odes_storage.models import Record
from .model_examples import (well_v2_file_contents, well_v3_file_contents, wellbore_v2_file_contents, wellbore_v3_file_contents, domain, data_partition, legal_tags,
well_v2_record_list, well_v3_record_list, wellbore_v2_record_list, wellbore_v3_record_list)
from .model_examples import (
well_v2_file_contents,
well_v3_file_contents,
wellbore_v2_file_contents,
wellbore_v3_file_contents,
marker_v3_file_contents,
trajectory_v3_file_contents,
welllog_v3_file_contents,
domain, data_partition, legal_tags,
well_v2_record_list,
well_v3_record_list,
well100_v3_list,
wellbore_v2_record_list,
wellbore_v3_record_list,
wellbore100_v3_list,
marker_v3_record_list,
marker110_v3_list,
trajectory_v3_record_list,
trajectory110_v3_list,
welllog_v3_record_list,
welllog110_v3_list
)
@pytest.fixture(scope="session")
......
import uuid
from typing import List
import pytest
......@@ -6,16 +5,15 @@ import os
import json
from odes_storage.models import Record
from app.model.osdu_model import Well, Wellbore, WellboreMarkerSet110, WellboreTrajectory110, WellLog110
from wdms_client.variables import Variables
@pytest.fixture(scope="session")
def well_v2_file_contents() -> str:
def load_model_example_file_contents(file_name: str):
with open(
os.path.join(
os.path.dirname(os.path.realpath(__file__)), "../../../app/model_examples/well_v2.json"
os.path.dirname(os.path.realpath(__file__)), f"../../../app/model_examples/{file_name}"
)
) as f:
......@@ -23,36 +21,38 @@ def well_v2_file_contents() -> str:
@pytest.fixture(scope="session")
def well_v3_file_contents() -> str:
def well_v2_file_contents() -> str:
return load_model_example_file_contents("well_v2.json")
with open(
os.path.join(
os.path.dirname(os.path.realpath(__file__)), "../../../app/model_examples/well_v3.json"
)
) as f:
return json.load(f)
@pytest.fixture(scope="session")
def well_v3_file_contents() -> str:
return load_model_example_file_contents("well_v3.json")
@pytest.fixture(scope="session")
def wellbore_v2_file_contents() -> str:
with open(
os.path.join(
os.path.dirname(os.path.realpath(__file__)), "../../../app/model_examples/wellbore_v2.json"
)
) as f:
return json.load(f)
return load_model_example_file_contents("wellbore_v2.json")
@pytest.fixture(scope="session")
def wellbore_v3_file_contents() -> str:
return load_model_example_file_contents("wellbore_v3.json")
@pytest.fixture(scope="session")
def marker_v3_file_contents() -> str:
return load_model_example_file_contents("marker_v3.json")
@pytest.fixture(scope="session")
def trajectory_v3_file_contents() -> str:
return load_model_example_file_contents("trajectory_v3.json")
with open(
os.path.join(
os.path.dirname(os.path.realpath(__file__)), "../../../app/model_examples/wellbore_v3.json"
)
) as f:
return json.load(f)
@pytest.fixture(scope="session")
def welllog_v3_file_contents() -> str:
return load_model_example_file_contents("wellLog_v3.json")
@pytest.fixture
......@@ -84,7 +84,7 @@ def well_v2_record_list(well_v2_file_contents, domain, data_partition, legal_tag
@pytest.fixture
def well_v3_record_list(well_v3_file_contents, domain, data_partition, legal_tags) -> List[Record]:
""" list of Well as Record model object loaded for model_example """
vars_to_replace = Variables.from_dict({
"domain": domain,
"datapartitionid": data_partition,
......@@ -97,6 +97,12 @@ def well_v3_record_list(well_v3_file_contents, domain, data_partition, legal_tag
return [Record.parse_obj(vars_to_replace.resolve(file_content)) for file_content in well_v3_file_contents]
@pytest.fixture
def well100_v3_list(well_v3_record_list) -> List[Well]:
""" provide a list of wellbore v.1.0.0"""
return [Well(**record.dict(exclude_unset=True, by_alias=True)) for record in well_v3_record_list]
@pytest.fixture
def wellbore_v2_record_list(wellbore_v2_file_contents, domain, data_partition, legal_tags) -> List[Record]:
......@@ -123,3 +129,68 @@ def wellbore_v3_record_list(wellbore_v3_file_contents, domain, data_partition, l
})
return [Record.parse_obj(vars_to_replace.resolve(file_content)) for file_content in wellbore_v3_file_contents]
@pytest.fixture
def wellbore100_v3_list(wellbore_v3_record_list) -> List[Wellbore]:
""" provide a list of wellbore v.1.0.0"""
return [Wellbore(**record.dict(exclude_unset=True, by_alias=True)) for record in wellbore_v3_record_list]
@pytest.fixture
def marker_v3_record_list(marker_v3_file_contents, domain, data_partition, legal_tags) -> List[Record]:
vars_to_replace = Variables.from_dict({
"domain": domain,
"datapartitionid": data_partition,
"legaltags": legal_tags,
})
# single record content
return [Record.parse_obj(vars_to_replace.resolve(marker_v3_file_contents))]
@pytest.fixture
def marker110_v3_list(marker_v3_record_list) -> List[WellboreMarkerSet110]:
""" provide a list of wellbore marker set v.1.1.0"""
return [WellboreMarkerSet110(**record.dict(exclude_unset=True, by_alias=True)) for record in marker_v3_record_list]
@pytest.fixture
def trajectory_v3_record_list(trajectory_v3_file_contents, domain, data_partition, legal_tags) -> List[Record]:
vars_to_replace = Variables.from_dict({
"domain": domain,
"datapartitionid": data_partition,
"legaltags": legal_tags,
})
return [Record.parse_obj(vars_to_replace.resolve(file_content)) for file_content in trajectory_v3_file_contents]
@pytest.fixture
def trajectory110_v3_list(trajectory_v3_record_list) -> List[WellboreTrajectory110]:
""" provide a list of wellbore trajectory v.1.1.0"""
return [WellboreTrajectory110(**record.dict(exclude_unset=True, by_alias=True)) for record in trajectory_v3_record_list]
@pytest.fixture
def welllog_v3_record_list(welllog_v3_file_contents, domain, data_partition, legal_tags) -> List[Record]:
vars_to_replace = Variables.from_dict({
"domain": domain,
"datapartitionid": data_partition,
"legaltags": legal_tags,
# to replace missing data in example
"wellboreId": "wellbore-id-example",
"welllogName": "my-example-welllog",
"welllogId": "my-welllog-v3-example",
})
return [Record.parse_obj(vars_to_replace.resolve(file_content)) for file_content in welllog_v3_file_contents]
@pytest.fixture
def welllog110_v3_list(welllog_v3_record_list) -> List[WellLog110]:
""" provide a list of wellLog v.1.1.0"""
return [WellLog110(**record.dict(exclude_unset=True, by_alias=True)) for record in welllog_v3_record_list]
......@@ -7,6 +7,8 @@ from app.clients.search_service_client import get_search_service
from app.clients.storage_service_client import get_storage_record_service
from app.context import Context, get_ctx
from app.model.osdu_model import Well, Wellbore, WellboreMarkerSet110, WellboreTrajectory110, WellLog110
def test_local_dev_config(local_dev_config):
......@@ -213,3 +215,32 @@ def test_app_configurable_with_client_and_mocks(
# remove the route we added to not mess with other tests
app.router.routes = [r for r in app.routes if r.name != inside_out_handler.__name__]
def test_well100_v3_list(well100_v3_list):
assert len(well100_v3_list) > 0
for inst in well100_v3_list:
Well.validate(inst)
def test_wellbore100_v3_list(wellbore100_v3_list):
assert len(wellbore100_v3_list) > 0
for inst in wellbore100_v3_list:
Wellbore.validate(inst)
def test_welllog110_v3_list(welllog110_v3_list):
assert len(welllog110_v3_list) > 0
for inst in welllog110_v3_list:
WellLog110.validate(inst)
def test_marker110_v3_list(marker110_v3_list):
assert len(marker110_v3_list) > 0
for inst in marker110_v3_list:
WellboreMarkerSet110.validate(inst)
def test_trajectory110_v3_list(trajectory110_v3_list):
assert len(trajectory110_v3_list) > 0
for inst in trajectory110_v3_list:
WellboreTrajectory110.validate(inst)
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