Showing
3 changed files
with
191 additions
and
1 deletions
... | ... | @@ -30,6 +30,19 @@ Library openprocurement_client.utils |
30 | 30 | [return] ${tender_id} |
31 | 31 | |
32 | 32 | |
33 | +Отримати internal id об'єкта моніторингу по UAid | |
34 | + [Arguments] ${username} ${monitoring_uaid} | |
35 | + Log ${username} | |
36 | + Log ${monitoring_uaid} | |
37 | + Log Many ${USERS.users['${username}'].id_map} | |
38 | + ${status}= Run Keyword And Return Status Dictionary Should Contain Key ${USERS.users['${username}'].id_map} ${monitoring_uaid} | |
39 | + Run Keyword And Return If ${status} Get From Dictionary ${USERS.users['${username}'].id_map} ${monitoring_uaid} | |
40 | + Call Method ${USERS.users['${username}'].dasu_client} get_monitorings | |
41 | + ${monitoring_id}= Wait Until Keyword Succeeds 5x 30 sec get_monitoring_id_by_uaid ${monitoring_uaid} ${USERS.users['${username}'].dasu_client} | |
42 | + Set To Dictionary ${USERS.users['${username}'].id_map} ${monitoring_uaid} ${monitoring_id} | |
43 | + [return] ${monitoring_id} | |
44 | + | |
45 | + | |
33 | 46 | Підготувати клієнт для користувача |
34 | 47 | [Arguments] ${username} |
35 | 48 | [Documentation] Відкрити браузер, створити об’єкти api wrapper і |
... | ... | @@ -48,7 +61,9 @@ Library openprocurement_client.utils |
48 | 61 | ${api_wrapper}= Run Keyword If '${RESOURCE}' == 'plans' |
49 | 62 | ... prepare_plan_api_wrapper ${USERS.users['${username}'].api_key} ${API_HOST_URL} ${API_VERSION} |
50 | 63 | ... ELSE prepare_api_wrapper ${USERS.users['${username}'].api_key} ${RESOURCE} ${API_HOST_URL} ${API_VERSION} ${ds_api_wraper} |
64 | + ${dasu_api_wraper}= prepare_dasu_api_wrapper ${USERS.users['${username}'].dasu_api_key} ${DASU_RESOURCE} ${DASU_API_HOST_URL} ${DASU_API_VERSION} ${ds_api_wraper} | |
51 | 65 | Set To Dictionary ${USERS.users['${username}']} client=${api_wrapper} |
66 | + Set To Dictionary ${USERS.users['${username}']} dasu_client=${dasu_api_wraper} | |
52 | 67 | Set To Dictionary ${USERS.users['${username}']} access_token=${EMPTY} |
53 | 68 | ${id_map}= Create Dictionary |
54 | 69 | Set To Dictionary ${USERS.users['${username}']} id_map=${id_map} |
... | ... | @@ -78,6 +93,18 @@ Library openprocurement_client.utils |
78 | 93 | [return] ${reply} |
79 | 94 | |
80 | 95 | |
96 | +Завантажити документ до об'єкта моніторингу | |
97 | + [Arguments] ${username} ${filepath} ${monitoring_uaid} ${monitoring_obj} | |
98 | + Log ${username} | |
99 | + Log ${monitoring_uaid} | |
100 | + Log ${filepath} | |
101 | + ${monitoring}= openprocurement_client.Пошук об'єкта моніторингу по ідентифікатору ${username} ${monitoring_uaid} | |
102 | + ${monitoring}= set_access_key ${monitoring} ${USERS.users['${username}'].access_token} | |
103 | + ${reply}= Call Method ${USERS.users['${username}'].dasu_client} upload_monitoring_document ${filepath} ${monitoring} ${monitoring_obj} | |
104 | + Log object data ${reply} reply | |
105 | + [return] ${reply} | |
106 | + | |
107 | + | |
81 | 108 | Отримати інформацію із документа |
82 | 109 | [Arguments] ${username} ${tender_uaid} ${doc_id} ${field} |
83 | 110 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} |
... | ... | @@ -160,6 +187,29 @@ Library openprocurement_client.utils |
160 | 187 | [return] ${tender.data.tenderID} |
161 | 188 | |
162 | 189 | |
190 | +Створити об'єкт моніторингу | |
191 | + [Arguments] ${username} ${monitoring_data} | |
192 | + ${monitoring}= Call Method ${USERS.users['${username}'].dasu_client} create_monitoring ${monitoring_data} | |
193 | + Log ${monitoring} | |
194 | + ${access_token}= Get Variable Value ${monitoring.access.token} | |
195 | + Log ${\n}${DASU_API_HOST_URL}/api/${DASU_API_VERSION}/monitorings/${monitoring.data.id}${\n} WARN | |
196 | + Set To Dictionary ${USERS.users['${username}']} access_token=${access_token} | |
197 | + Set To Dictionary ${USERS.users['${username}']} monitoring_data=${monitoring} | |
198 | + Log ${USERS.users['${username}'].monitoring_data} | |
199 | + [return] ${monitoring.data.monitoring_id} | |
200 | + | |
201 | + | |
202 | +Оприлюднити рішення про початок моніторингу | |
203 | + [Arguments] ${username} ${monitoring_uaid} | |
204 | + ${monitoring}= openprocurement_client.Пошук об'єкта моніторингу по ідентифікатору ${username} ${monitoring_uaid} | |
205 | + ${monitoring_data}= test_status_data active | |
206 | + Log ${monitoring_data} | |
207 | + ${reply}= Call Method ${USERS.users['${username}'].dasu_client} patch_monitoring ${monitoring_data} ${monitoring.data.id} | |
208 | + Log ${reply} | |
209 | + Set To Dictionary ${USERS.users['${username}']} monitoring_data=${reply} | |
210 | + [return] ${reply} | |
211 | + | |
212 | + | |
163 | 213 | Створити план |
164 | 214 | [Arguments] ${username} ${tender_data} |
165 | 215 | ${tender}= Call Method ${USERS.users['${username}'].client} create_plan ${tender_data} |
... | ... | @@ -185,6 +235,117 @@ Library openprocurement_client.utils |
185 | 235 | [return] ${tender} |
186 | 236 | |
187 | 237 | |
238 | +Пошук об'єкта моніторингу по ідентифікатору | |
239 | + [Arguments] ${username} ${monitoring_uaid} ${save_key}=monitoring_data | |
240 | + ${internalid}= openprocurement_client.Отримати internal id об'єкта моніторингу по UAid ${username} ${monitoring_uaid} | |
241 | + ${monitoring}= Call Method ${USERS.users['${username}'].dasu_client} get_monitoring ${internalid} | |
242 | + Set To Dictionary ${USERS.users['${username}']} ${save_key}=${monitoring} | |
243 | + ${monitoring}= munch_dict arg=${monitoring} | |
244 | + Log ${monitoring} | |
245 | + [return] ${monitoring} | |
246 | + | |
247 | + | |
248 | +Отримати доступ до об'єкта моніторингу | |
249 | + [Arguments] ${username} ${monitoring_uaid} ${save_key}=monitoring_data | |
250 | + ${token}= Set Variable ${USERS.users['${username}'].access_token} | |
251 | + ${internalid}= openprocurement_client.Отримати internal id об'єкта моніторингу по UAid ${username} ${monitoring_uaid} | |
252 | + ${monitoring}= Call Method ${USERS.users['${username}'].dasu_client} patch_credentials ${token} ${internalid} | |
253 | + Set To Dictionary ${USERS.users['${username}']} ${save_key}=${monitoring} | |
254 | + Log ${USERS.users['${username}'].monitoring_data} | |
255 | + ${monitoring}= munch_dict arg=${monitoring} | |
256 | + [return] ${monitoring} | |
257 | + | |
258 | + | |
259 | +Додати замовника як учасника процесу моніторингу | |
260 | + [Arguments] ${username} ${monitoring_uaid} ${party_data} | |
261 | + ${monitoring}= openprocurement_client.Пошук об'єкта моніторингу по ідентифікатору ${username} ${monitoring_uaid} | |
262 | + Log ${monitoring} | |
263 | + ${party}= Call Method ${USERS.users['${username}'].dasu_client} create_party ${monitoring} ${party_data} | |
264 | + Log ${party} | |
265 | + ${monitoring}= openprocurement_client.Пошук об'єкта моніторингу по ідентифікатору ${username} ${monitoring_uaid} | |
266 | + Set To Dictionary ${USERS.users['${username}']} monitoring_data=${monitoring} | |
267 | + Log ${USERS.users['${username}'].monitoring_data} | |
268 | + [return] ${monitoring} | |
269 | + | |
270 | + | |
271 | +Запитати в замовника пояснення | |
272 | + [Arguments] ${username} ${monitoring_uaid} ${dialogue_data} | |
273 | + ${monitoring}= openprocurement_client.Пошук об'єкта моніторингу по ідентифікатору ${username} ${monitoring_uaid} | |
274 | + ${dialogue}= Call Method ${USERS.users['${username}'].dasu_client} create_dialogue ${monitoring} ${dialogue_data} | |
275 | + Log ${dialogue} | |
276 | + ${monitoring}= openprocurement_client.Пошук об'єкта моніторингу по ідентифікатору ${username} ${monitoring_uaid} | |
277 | + Set To Dictionary ${USERS.users['${username}']} monitoring_data=${monitoring} | |
278 | + Log ${USERS.users['${username}'].monitoring_data} | |
279 | + [return] ${monitoring} | |
280 | + | |
281 | + | |
282 | +Надати пояснення замовником | |
283 | + [Arguments] ${username} ${monitoring_uaid} ${answer_data} | |
284 | + Log ${USERS.users['${username}'].access_token} | |
285 | + ${monitoring}= openprocurement_client.Отримати доступ до об'єкта моніторингу ${username} ${monitoring_uaid} | |
286 | + ${answer}= Call Method ${USERS.users['${username}'].dasu_client} patch_dialogue ${monitoring} ${answer_data} ${monitoring.data.dialogues[0].id} | |
287 | + Log ${answer} | |
288 | + [return] ${answer} | |
289 | + | |
290 | + | |
291 | +Змінити статус об’єкта моніторингу | |
292 | + [Arguments] ${username} ${monitoring_uaid} ${status_data} | |
293 | + ${monitoring}= openprocurement_client.Пошук об'єкта моніторингу по ідентифікатору ${username} ${monitoring_uaid} | |
294 | + ${reply}= Call Method ${USERS.users['${username}'].dasu_client} patch_monitoring ${status_data} ${monitoring.data.id} | |
295 | + Log ${reply} | |
296 | + Set To Dictionary ${USERS.users['${username}']} monitoring_data=${reply} | |
297 | + [return] ${reply} | |
298 | + | |
299 | + | |
300 | +Оприлюднити рішення про усунення порушення | |
301 | + [Arguments] ${username} ${monitoring_uaid} ${report_data} | |
302 | + ${monitoring}= openprocurement_client.Пошук об'єкта моніторингу по ідентифікатору ${username} ${monitoring_uaid} | |
303 | + ${reply}= Call Method ${USERS.users['${username}'].dasu_client} patch_monitoring ${report_data} ${monitoring.data.id} | |
304 | + Log ${reply} | |
305 | + Set To Dictionary ${USERS.users['${username}']} monitoring_data=${reply} | |
306 | + [return] ${reply} | |
307 | + | |
308 | + | |
309 | +Надати звіт про усунення порушення замовником | |
310 | + [Arguments] ${username} ${monitoring_uaid} ${resolution_data} ${file_path} | |
311 | + ${reply}= Call Method ${USERS.users['${username}'].dasu_client} upload_obj_document ${file_path} ${USERS.users['${username}'].monitoring_data} | |
312 | + ${documents}= Create List | |
313 | + Append To List ${documents} ${reply.data} | |
314 | + Set To Dictionary ${resolution_data.data} documents=${documents} | |
315 | + Log ${resolution_data} | |
316 | + ${resolution}= Call Method ${USERS.users['${username}'].dasu_client} patch_eliminationReport ${USERS.users['${username}'].monitoring_data} ${resolution_data} | |
317 | + Log ${resolution} | |
318 | + [return] ${resolution} | |
319 | + | |
320 | + | |
321 | +Зазначити, що порушення було оскаржено в суді | |
322 | + [Arguments] ${username} ${monitoring_uaid} ${appeal_data} ${file_path} | |
323 | + ${reply}= Call Method ${USERS.users['${username}'].dasu_client} upload_obj_document ${filepath} ${USERS.users['${username}'].monitoring_data} | |
324 | + ${documents}= Create List | |
325 | + Append To List ${documents} ${reply.data} | |
326 | + Set To Dictionary ${appeal_data.data} documents=${documents} | |
327 | + Log ${appeal_data} | |
328 | + ${appeal}= Call Method ${USERS.users['${username}'].dasu_client} patch_appeal ${USERS.users['${username}'].monitoring_data} ${appeal_data} | |
329 | + Log ${appeal} | |
330 | + [return] ${appeal} | |
331 | + | |
332 | + | |
333 | +Надати пояснення замовником з власної ініціативи | |
334 | + [Arguments] ${username} ${monitoring_uaid} ${dialogue_data} | |
335 | + ${party}= Call Method ${USERS.users['${username}'].dasu_client} create_dialogue ${USERS.users['${username}'].monitoring_data} ${dialogue_data} | |
336 | + Log ${party} | |
337 | + [return] ${monitoring} | |
338 | + | |
339 | + | |
340 | +Надати висновок про наявність/відсутність порушення в тендері | |
341 | + [Arguments] ${username} ${monitoring_uaid} ${conclusion_data} | |
342 | + ${monitoring}= openprocurement_client.Пошук об'єкта моніторингу по ідентифікатору ${username} ${monitoring_uaid} | |
343 | + ${reply}= Call Method ${USERS.users['${username}'].dasu_client} patch_monitoring ${conclusion_data} ${monitoring.data.id} | |
344 | + Log ${reply} | |
345 | + Set To Dictionary ${USERS.users['${username}']} monitoring_data=${reply} | |
346 | + [return] ${reply} | |
347 | + | |
348 | + | |
188 | 349 | Пошук плану по ідентифікатору |
189 | 350 | [Arguments] ${username} ${tender_uaid} ${save_key}=tender_data |
190 | 351 | ${internalid}= openprocurement_client.Отримати internal id плану по UAid ${username} ${tender_uaid} |
... | ... | @@ -253,6 +414,21 @@ Library openprocurement_client.utils |
253 | 414 | Fail Field not found: ${field_name} |
254 | 415 | |
255 | 416 | |
417 | +Отримати інформацію із об'єкта моніторингу | |
418 | + [Arguments] ${username} ${monitoring_uaid} ${field_name} | |
419 | + openprocurement_client.Пошук об'єкта моніторингу по ідентифікатору | |
420 | + ... ${username} | |
421 | + ... ${monitoring_uaid} | |
422 | + | |
423 | + ${status} ${field_value}= Run keyword and ignore error | |
424 | + ... Get from object | |
425 | + ... ${USERS.users['${username}'].monitoring_data.data} | |
426 | + ... ${field_name} | |
427 | + Run Keyword if '${status}' == 'PASS' Return from keyword ${field_value} | |
428 | + | |
429 | + Fail Field not found: ${field_name} | |
430 | + | |
431 | + | |
256 | 432 | Внести зміни в тендер |
257 | 433 | [Arguments] ${username} ${tender_uaid} ${fieldname} ${fieldvalue} |
258 | 434 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} |
... | ... | @@ -708,7 +884,6 @@ Library openprocurement_client.utils |
708 | 884 | [return] ${complaintID} |
709 | 885 | |
710 | 886 | |
711 | - | |
712 | 887 | Завантажити документацію до вимоги |
713 | 888 | [Arguments] ${username} ${tender_uaid} ${complaintID} ${document} |
714 | 889 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} | ... | ... |
1 | 1 | from openprocurement_client.client import Client, EDRClient |
2 | +from openprocurement_client.dasu_client import DasuClient | |
2 | 3 | from openprocurement_client.document_service_client \ |
3 | 4 | import DocumentServiceClient |
4 | 5 | from openprocurement_client.plan import PlansClient |
... | ... | @@ -158,3 +159,16 @@ class StableClient_plan(PlansClient): |
158 | 159 | |
159 | 160 | def prepare_plan_api_wrapper(key, host_url, api_version): |
160 | 161 | return StableClient_plan(key, host_url, api_version) |
162 | + | |
163 | + | |
164 | +class StableClient_dasu(DasuClient): | |
165 | + @retry(stop_max_attempt_number=100, wait_random_min=500, | |
166 | + wait_random_max=4000, retry_on_exception=retry_if_request_failed) | |
167 | + def request(self, *args, **kwargs): | |
168 | + return super(StableClient_dasu, self).request(*args, **kwargs) | |
169 | + | |
170 | + | |
171 | +def prepare_dasu_api_wrapper(key, resource, host_url, api_version, ds_client=None): | |
172 | + print key | |
173 | + return StableClient_dasu(key, resource, host_url, api_version, | |
174 | + ds_client=ds_client) | |
\ No newline at end of file | ... | ... |
Please
register
or
login
to post a comment