Skip to content

Commit

Permalink
actually upload node file if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ola Liabøtrø committed Sep 2, 2024
1 parent 9f1e3ca commit 9c61005
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/tests_integration/test_api/test_diagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ def diagram_node(cognite_client: CogniteClient, pnid_file_id: int, diagram_space
.as_id()
)

node_file = cognite_client.files.retrieve(instance_id=diagram_node_id)
# Create the file if not existing already
if cognite_client.files.retrieve(instance_id=diagram_node_id) is None:
if node_file is None or node_file.uploaded is False:
cognite_client.files.upload_content_bytes(
content=cognite_client.files.download_bytes(file_id=file.id), instance_id=diagram_node.instance_id
content=cognite_client.files.download_bytes(id=file.id), instance_id=diagram_node_id
)
return diagram_node_id

Expand Down

0 comments on commit 9c61005

Please sign in to comment.