Hi Team,
We are working on a POC , where we need to create unit test cases where we are facing different issues .For reference we are using code from Cognite Hub
Below attaching our code and output expectations .
Please help with the approach to resolve this issue
ts_retrieved = [
TimeSeries(
id= 3973245479016710,
external_id= "Brazil:3W:Well-Bore-19B_target_throughput",
name= "Brazil:3W:Well-Bore-19B_target_throughput",
is_string= False,
metadata= {},
unit= "Barrel",
asset_id= 3332326574821917,
is_step= False,
description= "target volume for a oil well bore",
security_categories= [],
data_set_id= 8739280581150161,
created_time= "2023-05-02 09:37:04.944000",
last_updated_time= "2023-05-02 09:37:04.944000"
)
]
@pytest.fixture
def cognite_client_mock():
with monkeypatch_cognite_client() as client:
client.assets.retrieve().time_series().get().return_value = ts_retrieved
return client
Method code
ts_data = c.assets.retrieve(external_id=asset_name).time_series().get(external_id=f'{asset_name}_{ts_type}').to_pandas()
ts_internal_id = int(ts_data.loc["id"])
print(f'ts_internal_id {ts_internal_id}')
print(f'ts_internal_id {ts_data.head(5)}')
Expectation from print is ts_internal_id = 3973245479016710
Actual Output -

Please provide suggestions on how to achieve the desired output in unit testing the cognite calls.
Thanks.