|
6 | 6 |
|
7 | 7 | @pytest.mark.usefixtures("seed_resource_names", "seed_simulator_routine_revisions")
|
8 | 8 | class TestSimulatorRuns:
|
9 |
| - def test_create_run( |
10 |
| - self, cognite_client: CogniteClient, seed_simulator_routine_revisions, seed_resource_names |
11 |
| - ) -> None: |
12 |
| - routine_external_id = seed_resource_names["simulator_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 |
| - ] |
20 |
| - ) |
21 |
| - assert created_runs[0].routine_external_id == routine_external_id |
22 |
| - assert created_runs[0].id is not None |
23 |
| - |
24 | 9 | def test_list_filtering(self, cognite_client: CogniteClient, seed_resource_names) -> None:
|
25 | 10 | routine_external_id = seed_resource_names["simulator_routine_external_id"]
|
26 | 11 | runs_filtered_by_status = []
|
@@ -50,7 +35,23 @@ def test_list_filtering(self, cognite_client: CogniteClient, seed_resource_names
|
50 | 35 | status=current_status, routine_external_ids=[routine_external_id]
|
51 | 36 | )
|
52 | 37 | runs_filtered_by_status.append(filter_by_status[0].dump())
|
53 |
| - |
54 | 38 | filter_by_routine = cognite_client.simulators.runs.list(routine_external_ids=[routine_external_id]).dump()
|
55 |
| - for run in runs_filtered_by_status: |
56 |
| - assert run in filter_by_routine |
| 39 | + assert filter_by_routine == runs_filtered_by_status |
| 40 | + assert sorted(runs_filtered_by_status, key=lambda x: x["id"]) == sorted( |
| 41 | + filter_by_routine, key=lambda x: x["id"] |
| 42 | + ) |
| 43 | + |
| 44 | + def test_create_run( |
| 45 | + self, cognite_client: CogniteClient, seed_simulator_routine_revisions, seed_resource_names |
| 46 | + ) -> None: |
| 47 | + routine_external_id = seed_resource_names["simulator_routine_external_id"] |
| 48 | + created_runs = cognite_client.simulators.runs.create( |
| 49 | + [ |
| 50 | + SimulationRunWrite( |
| 51 | + run_type="external", |
| 52 | + routine_external_id=routine_external_id, |
| 53 | + ) |
| 54 | + ] |
| 55 | + ) |
| 56 | + assert created_runs[0].routine_external_id == routine_external_id |
| 57 | + assert created_runs[0].id is not None |
0 commit comments