Skip to content

Commit 61bcb53

Browse files
committed
tests: update fixture\
1 parent 66ba9c7 commit 61bcb53

File tree

1 file changed

+2
-39
lines changed
  • tests/test_unit/test_cdf_tk/test_commands/test_migration_cmd

1 file changed

+2
-39
lines changed

tests/test_unit/test_cdf_tk/test_commands/test_migration_cmd/test_command.py

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@
99
import respx
1010
from cognite.client.data_classes import Annotation, AnnotationList, Asset, AssetList
1111
from cognite.client.data_classes.data_modeling import (
12-
ContainerId,
1312
DataModel,
1413
DataModelList,
15-
DirectRelation,
16-
MappedProperty,
1714
NodeApply,
1815
NodeOrEdgeData,
19-
Text,
2016
View,
2117
ViewId,
2218
)
@@ -45,7 +41,7 @@
4541

4642
@pytest.fixture
4743
def cognite_migration_model(
48-
toolkit_config: ToolkitClientConfig, rsps: responses.RequestsMock
44+
toolkit_config: ToolkitClientConfig, rsps: responses.RequestsMock, cognite_core_no_3D: DataModel[View]
4945
) -> Iterator[responses.RequestsMock]:
5046
config = toolkit_config
5147
mapping_by_id = {mapping.external_id: mapping for mapping in create_default_mappings()}
@@ -68,42 +64,9 @@ def cognite_migration_model(
6864
json={"items": node_items},
6965
status=200,
7066
)
71-
72-
# Lookup CogniteAsset, this is not the full model, just the properties we need for the
73-
# migration
74-
default_prop_args = dict(nullable=True, immutable=False, auto_increment=False)
75-
default_view_args = dict(
76-
last_updated_time=1,
77-
created_time=1,
78-
description=None,
79-
name=None,
80-
implements=[],
81-
writable=True,
82-
used_for="node",
83-
is_global=True,
84-
filter=None,
85-
)
86-
cognite_asset = View(
87-
space="cdf_cdm",
88-
external_id="CogniteAsset",
89-
version="v1",
90-
properties={
91-
"name": MappedProperty(ContainerId("cdf_cdm", "CogniteDescribable"), "name", Text(), **default_prop_args),
92-
"description": MappedProperty(
93-
ContainerId("cdf_cdm", "CogniteDescribable"), "description", Text(), **default_prop_args
94-
),
95-
"source": MappedProperty(
96-
ContainerId("cdf_cdm", "CogniteSourceable"), "name", DirectRelation(), **default_prop_args
97-
),
98-
"tags": MappedProperty(
99-
ContainerId("cdf_cdm", "CogniteDescribable"), "tags", Text(is_list=True), **default_prop_args
100-
),
101-
},
102-
**default_view_args,
103-
)
10467
rsps.post(
10568
config.create_api_url("models/views/byids"),
106-
json={"items": [cognite_asset.dump()]},
69+
json={"items": [view.dump() for view in cognite_core_no_3D.views]},
10770
)
10871
# Migration model
10972
migration_model = COGNITE_MIGRATION_MODEL.dump()

0 commit comments

Comments
 (0)