|
1 | 1 | import pytest
|
2 | 2 | import uuid
|
| 3 | +from copy import deepcopy |
| 4 | +from datetime import datetime |
3 | 5 |
|
4 | 6 | from citrine.informatics.executions.design_execution import DesignExecution
|
5 | 7 | from citrine.resources.design_execution import DesignExecutionCollection
|
@@ -99,6 +101,31 @@ def test_workflow_execution_results(workflow_execution: DesignExecution, session
|
99 | 101 | assert session.last_call == FakeCall(method='GET', path=expected_path, params={"per_page": 4, 'page': 1})
|
100 | 102 |
|
101 | 103 |
|
| 104 | +def test_workflow_execution_results_pinned(workflow_execution: DesignExecution, session, example_candidates): |
| 105 | + # Given |
| 106 | + pinned_by = uuid.uuid4() |
| 107 | + pinned_time = datetime.now() |
| 108 | + example_candidates_pinned = deepcopy(example_candidates) |
| 109 | + example_candidates_pinned["response"][0]["pinned"] = { |
| 110 | + "user": pinned_by, |
| 111 | + "time": pinned_time |
| 112 | + } |
| 113 | + session.set_response(example_candidates_pinned) |
| 114 | + |
| 115 | + # When |
| 116 | + candidates = list(workflow_execution.candidates(per_page=4)) |
| 117 | + |
| 118 | + # Then |
| 119 | + expected_path = '/projects/{}/design-workflows/{}/executions/{}/candidates'.format( |
| 120 | + workflow_execution.project_id, |
| 121 | + workflow_execution.workflow_id, |
| 122 | + workflow_execution.uid, |
| 123 | + ) |
| 124 | + assert session.last_call == FakeCall(method='GET', path=expected_path, params={"per_page": 4, 'page': 1}) |
| 125 | + assert candidates[0].pinned_by == pinned_by |
| 126 | + assert candidates[0].pinned_time == pinned_time |
| 127 | + |
| 128 | + |
102 | 129 | def test_list(collection: DesignExecutionCollection, session):
|
103 | 130 | session.set_response({"per_page": 4, "next": "", "response": []})
|
104 | 131 | lst = list(collection.list(per_page=4))
|
|
0 commit comments