Commit 28a7be19 authored by Jeremie Hallal's avatar Jeremie Hallal
Browse files

do not remove trajectory channel information

parent c60b8ae9
Pipeline #67784 failed with stages
in 22 minutes and 39 seconds
......@@ -244,11 +244,11 @@ async def post_traj_data(
channels = { c for c in} = []
for name in df.columns:
channel = channels.get(name, TrajectoryChannel(name=name))
channel.bulkURI = + ":" + name
if not in channels:
# Update record
storage_client = await get_storage_record_service(ctx)
......@@ -19,6 +19,7 @@ from fastapi.testclient import TestClient
from fastapi import Header, status
import pytest
import copy
from import BlobStorageBase
from import LocalFSBlobStorage
......@@ -154,8 +155,14 @@ def client_with_log(client):
def test_traj_bulk(client, orient_value, data):
traj_cpy = copy.deepcopy(traj)
traj_cpy['data']['channels'] = [
{'name': 'X', 'family': 'X_family'},
{'name': 'NOT_IN_BULK', 'family': 'NOT_IN_BULK_family'},
# Create or update a traj record
response ="/ddms/v2/trajectories", json=[traj], headers=headers)
response ="/ddms/v2/trajectories", json=[traj_cpy], headers=headers)
assert response.ok, "Create or update trajectory failed"
# get data
......@@ -178,12 +185,14 @@ def test_traj_bulk(client, orient_value, data):
assert computed_record["legal"] == legal, "legal in the record should match trajectory acl"
assert computed_record["data"]["bulkURI"], "trajectory record should have a bulkid"
computed_channel = {channel["name"]: channel["bulkURI"] for channel in computed_record["data"]["channels"]}
computed_channel = {channel["name"]: channel for channel in computed_record["data"]["channels"]}
for c in ["MD", "X", "Y", 'Z']:
assert computed_channel[c]['bulkURI'] == computed_record["data"]["bulkURI"] + f":{c}", "bulkid for channel MD should match {data.bulkid}:{c}"
assert computed_channel["X"]["family"] == "X_family", "channels properties should not be overrided"
assert computed_channel["MD"] == computed_record["data"]["bulkURI"] + ":MD", "bulkid for channel MD should match {data.bulkid}:MD"
assert computed_channel["X"] == computed_record["data"]["bulkURI"] + ":X", "bulkid for channel X should match {data.bulkid}:MD"
assert computed_channel["Y"] == computed_record["data"]["bulkURI"] + ":Y", "bulkid for channel Y should match {data.bulkid}:MD"
assert computed_channel["Z"] == computed_record["data"]["bulkURI"] + ":Z", "bulkid for channel Z should match {data.bulkid}:MD"
assert computed_channel["NOT_IN_BULK"].get('bulkURI', None) is None
assert computed_channel["NOT_IN_BULK"]["family"] == "NOT_IN_BULK_family", "channels properties should not be deleted if not in bulk"
# get data
response = client.get(f"/ddms/v2/trajectories/{trajectory_id}/data?orient={orient_value}", headers=headers)
......@@ -265,4 +274,4 @@ def test_log_version_data_orient_param_validation_negative(client_with_log):
# get data for previous version
response = client.get(f"/ddms/v2/trajectories/{trajectory_id}/versions/{version_id}/data", params={"orient": "wrong"}, headers=headers)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
\ No newline at end of file
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
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