1
1
import pytest
2
2
3
3
from cognite .client ._cognite_client import CogniteClient
4
- from cognite .client .data_classes .simulators .runs import SimulationRunWrite , SimulatorRunsList
5
-
6
-
7
- def create_simulation_run (
8
- cognite_client : CogniteClient ,
9
- routine_external_id : str ,
10
- ) -> SimulatorRunsList :
11
- return cognite_client .simulators .runs .create (
12
- [
13
- SimulationRunWrite (
14
- run_type = "external" ,
15
- routine_external_id = routine_external_id ,
16
- )
17
- ]
18
- )
4
+ from cognite .client .data_classes .simulators .runs import SimulationRunWrite
19
5
20
6
21
7
@pytest .mark .usefixtures ("seed_resource_names" , "seed_simulator_routine_revisions" )
@@ -24,9 +10,13 @@ def test_create_run(
24
10
self , cognite_client : CogniteClient , seed_simulator_routine_revisions , seed_resource_names
25
11
) -> None :
26
12
routine_external_id = seed_resource_names ["simulator_routine_external_id" ]
27
- created_runs = create_simulation_run (
28
- cognite_client = cognite_client ,
29
- routine_external_id = routine_external_id ,
13
+ created_runs = cognite_client .simulators .runs .create (
14
+ [
15
+ SimulationRunWrite (
16
+ run_type = "external" ,
17
+ routine_external_id = routine_external_id ,
18
+ )
19
+ ]
30
20
)
31
21
assert created_runs [0 ].routine_external_id == routine_external_id
32
22
assert created_runs [0 ].id is not None
@@ -35,9 +25,13 @@ def test_list_filtering(self, cognite_client: CogniteClient, seed_resource_names
35
25
routine_external_id = seed_resource_names ["simulator_routine_external_id" ]
36
26
status = ["running" , "success" , "failure" ]
37
27
for _ in range (3 ):
38
- created_runs = create_simulation_run (
39
- cognite_client = cognite_client ,
40
- routine_external_id = routine_external_id ,
28
+ created_runs = cognite_client .simulators .runs .create (
29
+ [
30
+ SimulationRunWrite (
31
+ run_type = "external" ,
32
+ routine_external_id = routine_external_id ,
33
+ )
34
+ ]
41
35
)
42
36
assert created_runs [0 ].routine_external_id == routine_external_id
43
37
status_to_be_set = status .pop (0 )
0 commit comments