Commit 473616eb authored by Victor Dosda's avatar Victor Dosda
Browse files

added log test and fixed chunking test

parent 6b1aa1f1
import io import io
from app.bulk_persistence.dask.errors import BulkNotFound
from tests.unit.test_utils import nope_logger_fixture from tests.unit.test_utils import nope_logger_fixture
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
...@@ -46,12 +48,18 @@ Definitions = { ...@@ -46,12 +48,18 @@ Definitions = {
"BaseDepthMeasuredDepth": 12345.6, "BaseDepthMeasuredDepth": 12345.6,
"VerticalMeasurement": {"VerticalMeasurement": 12345.6} "VerticalMeasurement": {"VerticalMeasurement": 12345.6}
} }
},
'Log': {
'base_url': '/ddms/v2/logs',
'chunking_url': '/alpha/ddms/v2/logs', # TODO: update when no longer alpha
'kind': 'osdu:wks:log:1.0.5',
'record_data': {
"name": "myLog_name"
}
} }
} }
EntityTypeParams = ['WellLog', 'WellboreTrajectory', 'Log']
EntityTypeParams = ['WellLog', 'WellboreTrajectory']
def _create_df_from_response(response): def _create_df_from_response(response):
f = io.BytesIO(response.content) f = io.BytesIO(response.content)
...@@ -193,9 +201,9 @@ def test_send_all_data_once(setup_client, ...@@ -193,9 +201,9 @@ def test_send_all_data_once(setup_client,
initial_data_df = generate_df(columns, range(5, 13)) initial_data_df = generate_df(columns, range(5, 13))
data_to_send = create_func(initial_data_df) data_to_send = create_func(initial_data_df)
headers = {'content-type': content_type_header} headers = {'content-type': content_type_header}
# test no data
get_response_no_data = client.get(f'{Definitions[entity_type]["base_url"]}/{record_id}/data', headers=headers) with pytest.raises(BulkNotFound):
assert get_response_no_data.status_code == 404 client.get(f'{Definitions[entity_type]["chunking_url"]}/{record_id}/data', headers=headers)
write_response = client.post(f'{chunking_url}/{record_id}/data', data=data_to_send, headers=headers) write_response = client.post(f'{chunking_url}/{record_id}/data', data=data_to_send, headers=headers)
assert write_response.status_code == 200 assert write_response.status_code == 200
......
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