Debian Codegraph @

src/globus_sdk/testing/data/flows/get_run_logs.py

raw
1 from responses.matchers import query_param_matcher
2
3 from globus_sdk.testing import RegisteredResponse, ResponseList, ResponseSet
4
5 RUN_ID = "cfdaf0a4-0931-40af-b974-b619ce69f401"
6 OWNER_URN = "urn:globus:auth:identity:944cfbe8-60f8-474d-a634-a0c1ad543a54"
7 RUN_LOGS_RESPONSE = {
8 "limit": 10,
9 "has_next_page": False,
10 "entries": [
11 {
12 "time": "2023-04-25T18:54:30.683000+00:00",
13 "code": "FlowStarted",
14 "description": "The Flow Instance started execution",
15 "details": {"input": {}},
16 },
17 {
18 "time": "2023-04-25T18:54:30.715000+00:00",
19 "code": "ActionStarted",
20 "description": "State SyncHelloWorld of type Action started",
21 "details": {
22 "state_name": "SyncHelloWorld",
23 "state_type": "Action",
24 "input": {"echo_string": "sync!"},
25 },
26 },
27 {
28 "time": "2023-04-25T18:54:31.850000+00:00",
29 "code": "ActionCompleted",
30 "description": "State SyncHelloWorld of type Action completed",
31 "details": {
32 "state_name": "SyncHelloWorld",
33 "state_type": "Action",
34 "output": {
35 "action_id": "19NqhOnDlt2Y3",
36 "completion_time": "2023-04-25T18:54:31.341170+00:00",
37 "creator_id": OWNER_URN,
38 "details": {"Hello": "World", "hello": "sync!"},
39 "display_status": "SUCCEEDED",
40 "label": None,
41 "manage_by": [],
42 "monitor_by": [],
43 "release_after": None,
44 "start_time": "2023-04-25T18:54:31.340484+00:00",
45 "status": "SUCCEEDED",
46 "state_name": "SyncHelloWorld",
47 },
48 },
49 },
50 {
51 "time": "2023-04-25T18:54:31.913000+00:00",
52 "code": "FlowSucceeded",
53 "description": "The Flow Instance completed successfully",
54 "details": {
55 "output": {
56 "action_id": "19NqhOnDlt2Y3",
57 "completion_time": "2023-04-25T18:54:31.341170+00:00",
58 "creator_id": OWNER_URN,
59 "details": {"Hello": "World", "hello": "sync!"},
60 "display_status": "SUCCEEDED",
61 "label": None,
62 "manage_by": [],
63 "monitor_by": [],
64 "release_after": None,
65 "start_time": "2023-04-25T18:54:31.340484+00:00",
66 "status": "SUCCEEDED",
67 "state_name": "SyncHelloWorld",
68 }
69 },
70 },
71 ],
72 }
73
74 PAGINATED_RUN_LOG_RESPONSES = [
75 {
76 "limit": 10,
77 "has_next_page": True,
78 "marker": "fake_run_logs_marker",
79 "entries": [
80 {
81 "time": "2023-04-25T18:54:30.683000+00:00",
82 "code": "FlowStarted",
83 "description": "The Flow Instance started execution",
84 "details": {"input": {}},
85 },
86 {
87 "time": "2023-04-25T18:54:30.715000+00:00",
88 "code": "PassStarted",
89 "description": "State PassState of type Pass started",
90 "details": {
91 "state_name": "PassState",
92 "state_type": "Pass",
93 "input": {},
94 },
95 },
96 {
97 "time": "2023-04-25T18:54:30.715000+00:00",
98 "code": "PassCompleted",
99 "description": "State PassState of type Pass completed",
100 "details": {
101 "state_name": "PassState",
102 "state_type": "Pass",
103 "output": {},
104 },
105 },
106 {
107 "time": "2023-04-25T18:54:30.715000+00:00",
108 "code": "PassStarted",
109 "description": "State PassState2 of type Pass started",
110 "details": {
111 "state_name": "PassState2",
112 "state_type": "Pass",
113 "input": {},
114 },
115 },
116 {
117 "time": "2023-04-25T18:54:30.715000+00:00",
118 "code": "PassCompleted",
119 "description": "State PassState2 of type Pass completed",
120 "details": {
121 "state_name": "PassState2",
122 "state_type": "Pass",
123 "output": {},
124 },
125 },
126 {
127 "time": "2023-04-25T18:54:30.715000+00:00",
128 "code": "PassStarted",
129 "description": "State PassState3 of type Pass started",
130 "details": {
131 "state_name": "PassState3",
132 "state_type": "Pass",
133 "input": {},
134 },
135 },
136 {
137 "time": "2023-04-25T18:54:30.715000+00:00",
138 "code": "PassCompleted",
139 "description": "State PassState3 of type Pass completed",
140 "details": {
141 "state_name": "PassState3",
142 "state_type": "Pass",
143 "output": {},
144 },
145 },
146 {
147 "time": "2023-04-25T18:54:30.715000+00:00",
148 "code": "PassStarted",
149 "description": "State PassState4 of type Pass started",
150 "details": {
151 "state_name": "PassState4",
152 "state_type": "Pass",
153 "input": {},
154 },
155 },
156 {
157 "time": "2023-04-25T18:54:30.715000+00:00",
158 "code": "PassCompleted",
159 "description": "State PassState4 of type Pass completed",
160 "details": {
161 "state_name": "PassState4",
162 "state_type": "Pass",
163 "output": {},
164 },
165 },
166 {
167 "time": "2023-04-25T18:54:30.715000+00:00",
168 "code": "ActionStarted",
169 "description": "State SyncHelloWorld of type Action started",
170 "details": {
171 "state_name": "SyncHelloWorld",
172 "state_type": "Action",
173 "input": {"echo_string": "sync!"},
174 },
175 },
176 ],
177 },
178 {
179 "limit": 10,
180 "has_next_page": False,
181 "entries": [
182 {
183 "time": "2023-04-25T18:54:31.850000+00:00",
184 "code": "ActionCompleted",
185 "description": "State SyncHelloWorld of type Action completed",
186 "details": {
187 "state_name": "SyncHelloWorld",
188 "state_type": "Action",
189 "output": {
190 "action_id": "19NqhOnDlt2Y3",
191 "completion_time": "2023-04-25T18:54:31.341170+00:00",
192 "creator_id": OWNER_URN,
193 "details": {"Hello": "World", "hello": "sync!"},
194 "display_status": "SUCCEEDED",
195 "label": None,
196 "manage_by": [],
197 "monitor_by": [],
198 "release_after": None,
199 "start_time": "2023-04-25T18:54:31.340484+00:00",
200 "status": "SUCCEEDED",
201 "state_name": "SyncHelloWorld",
202 },
203 },
204 },
205 {
206 "time": "2023-04-25T18:54:31.913000+00:00",
207 "code": "FlowSucceeded",
208 "description": "The Flow Instance completed successfully",
209 "details": {
210 "output": {
211 "action_id": "19NqhOnDlt2Y3",
212 "completion_time": "2023-04-25T18:54:31.341170+00:00",
213 "creator_id": OWNER_URN,
214 "details": {"Hello": "World", "hello": "sync!"},
215 "display_status": "SUCCEEDED",
216 "label": None,
217 "manage_by": [],
218 "monitor_by": [],
219 "release_after": None,
220 "start_time": "2023-04-25T18:54:31.340484+00:00",
221 "status": "SUCCEEDED",
222 "state_name": "SyncHelloWorld",
223 }
224 },
225 },
226 ],
227 },
228 ]
229
230
231 RESPONSES = ResponseSet(
232 metadata={"run_id": RUN_ID},
233 default=RegisteredResponse(
234 service="flows",
235 method="GET",
236 path=f"/runs/{RUN_ID}/log",
237 json=RUN_LOGS_RESPONSE,
238 ),
239 paginated=ResponseList(
240 RegisteredResponse(
241 service="flows",
242 method="GET",
243 path=f"/runs/{RUN_ID}/log",
244 json=PAGINATED_RUN_LOG_RESPONSES[0],
245 match=[query_param_matcher(params={})],
246 ),
247 RegisteredResponse(
248 service="flows",
249 method="GET",
250 path=f"/runs/{RUN_ID}/log",
251 json=PAGINATED_RUN_LOG_RESPONSES[1],
252 match=[
253 query_param_matcher(
254 params={"marker": PAGINATED_RUN_LOG_RESPONSES[0]["marker"]}
255 )
256 ],
257 ),
258 ),
259 )