Commit e5889dd708a23f8427d9cea757d3ea6c47c0abe2
Merge pull request #102 from mykhaly/work_synchronisation_time_formula
Update synchronisation time formula
Showing
3 changed files
with
59 additions
and
41 deletions
... | ... | @@ -13,7 +13,7 @@ Library openprocurement_client_helper.py |
13 | 13 | ${tenders}= get_tenders ${USERS.users['${username}'].client} |
14 | 14 | Log Many @{tenders} |
15 | 15 | :FOR ${tender} IN @{tenders} |
16 | - \ Set To Dictionary ${ID_MAP} ${tender.tenderID} ${tender.id} | |
16 | + \ Set To Dictionary ${ID_MAP} ${tender.tenderID}=${tender.id} | |
17 | 17 | Log Many ${ID_MAP} |
18 | 18 | Dictionary Should Contain Key ${ID_MAP} ${tender_uaid} |
19 | 19 | Run Keyword And Return Get From Dictionary ${ID_MAP} ${tender_uaid} |
... | ... | @@ -25,8 +25,8 @@ Library openprocurement_client_helper.py |
25 | 25 | Log ${api_host_url} |
26 | 26 | Log ${api_version} |
27 | 27 | ${api_wrapper}= prepare_api_wrapper ${USERS.users['${username}'].api_key} ${api_host_url} ${api_version} |
28 | - Set To Dictionary ${USERS.users['${username}']} client ${api_wrapper} | |
29 | - Set To Dictionary ${USERS.users['${username}']} access_token ${EMPTY} | |
28 | + Set To Dictionary ${USERS.users['${username}']} client=${api_wrapper} | |
29 | + Set To Dictionary ${USERS.users['${username}']} access_token=${EMPTY} | |
30 | 30 | ${ID_MAP}= Create Dictionary |
31 | 31 | Set Suite Variable ${ID_MAP} |
32 | 32 | Log Variables |
... | ... | @@ -42,8 +42,8 @@ Library openprocurement_client_helper.py |
42 | 42 | ${tender}= Call Method ${USERS.users['${username}'].client} create_tender ${tender_data} |
43 | 43 | Log object data ${tender} created_tender |
44 | 44 | ${access_token}= Get Variable Value ${tender.access.token} |
45 | - Set To Dictionary ${USERS.users['${username}']} access_token ${access_token} | |
46 | - Set To Dictionary ${USERS.users['${username}']} tender_data ${tender} | |
45 | + Set To Dictionary ${USERS.users['${username}']} access_token=${access_token} | |
46 | + Set To Dictionary ${USERS.users['${username}']} tender_data=${tender} | |
47 | 47 | Log ${access_token} |
48 | 48 | Log ${tender.data.id} |
49 | 49 | Log ${USERS.users['${username}'].tender_data} |
... | ... | @@ -108,7 +108,7 @@ Library openprocurement_client_helper.py |
108 | 108 | Log ${internalid} |
109 | 109 | ${tender}= Call Method ${USERS.users['${username}'].client} get_tender ${internalid} |
110 | 110 | ${tender}= set_access_key ${tender} ${USERS.users['${username}'].access_token} |
111 | - Set To Dictionary ${USERS.users['${username}']} tender_data ${tender} | |
111 | + Set To Dictionary ${USERS.users['${username}']} tender_data=${tender} | |
112 | 112 | Log ${tender} |
113 | 113 | [Return] ${tender} |
114 | 114 | |
... | ... | @@ -161,7 +161,7 @@ Library openprocurement_client_helper.py |
161 | 161 | [Arguments] ${username} ${tender_uaid} ${bid} |
162 | 162 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} |
163 | 163 | ${biddingresponse}= Call Method ${USERS.users['${username}'].client} create_bid ${tender} ${bid} |
164 | - Set To Dictionary ${USERS.users['${username}'].bidresponses['bid'].data} id ${biddingresponse['data']['id']} | |
164 | + Set To Dictionary ${USERS.users['${username}'].bidresponses['bid'].data} id=${biddingresponse['data']['id']} | |
165 | 165 | Log ${biddingresponse} |
166 | 166 | [return] ${biddingresponse} |
167 | 167 | |
... | ... | @@ -180,7 +180,7 @@ Library openprocurement_client_helper.py |
180 | 180 | Скасувати цінову пропозицію |
181 | 181 | [Arguments] ${username} ${tender_uaid} ${bid} |
182 | 182 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} |
183 | - Set To Dictionary ${bid.data} id ${USERS.users['${username}'].bidresponses['bid'].data.id} | |
183 | + Set To Dictionary ${bid.data} id=${USERS.users['${username}'].bidresponses['bid'].data.id} | |
184 | 184 | ${tender}= set_access_key ${tender} ${USERS.users['${username}'].bidresponses['resp'].access.token} |
185 | 185 | ${changed_bid}= Call Method ${USERS.users['${username}'].client} delete_bid ${tender} ${bid} |
186 | 186 | Log ${changed_bid} |
... | ... | @@ -203,7 +203,7 @@ Library openprocurement_client_helper.py |
203 | 203 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} |
204 | 204 | ${tender}= set_access_key ${tender} ${USERS.users['${username}'].bidresponses['resp'].access.token} |
205 | 205 | ${response}= Call Method ${USERS.users['${username}'].client} upload_bid_document ${path} ${tender} ${bid_id} ${doc_type} |
206 | - ${uploaded_file} = Create Dictionary filepath ${path} upload_response ${response} | |
206 | + ${uploaded_file} = Create Dictionary filepath=${path} upload_response=${response} | |
207 | 207 | Log ${response} |
208 | 208 | Log object data ${uploaded_file} |
209 | 209 | [return] ${uploaded_file} |
... | ... | @@ -214,7 +214,7 @@ Library openprocurement_client_helper.py |
214 | 214 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${TENDER['TENDER_UAID']} |
215 | 215 | ${tender}= set_access_key ${tender} ${USERS.users['${username}'].bidresponses['resp'].access.token} |
216 | 216 | ${response}= Call Method ${USERS.users['${username}'].client} update_bid_document ${path} ${tender} ${bidid} ${docid} |
217 | - ${uploaded_file} = Create Dictionary filepath ${path} upload_response ${response} | |
217 | + ${uploaded_file} = Create Dictionary filepath=${path} upload_response=${response} | |
218 | 218 | Log ${response} |
219 | 219 | Log object data ${uploaded_file} |
220 | 220 | [return] ${uploaded_file} |
... | ... | @@ -420,7 +420,7 @@ Library openprocurement_client_helper.py |
420 | 420 | [Arguments] ${username} ${tender_uaid} ${award_num} |
421 | 421 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} |
422 | 422 | ${award}= create_data_dict data.status active |
423 | - Set To Dictionary ${award.data} id ${tender.data.awards[${award_num}].id} | |
423 | + Set To Dictionary ${award.data} id=${tender.data.awards[${award_num}].id} | |
424 | 424 | ${reply}= Call Method ${USERS.users['${username}'].client} patch_award ${tender} ${award} |
425 | 425 | Log ${reply} |
426 | 426 | |
... | ... | @@ -433,7 +433,7 @@ Library openprocurement_client_helper.py |
433 | 433 | [Arguments] ${username} ${tender_uid} ${award_num} |
434 | 434 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uid} |
435 | 435 | ${award}= create_data_dict data.status unsuccessful |
436 | - Set To Dictionary ${award.data} id ${tender.data.awards[${award_num}].id} | |
436 | + Set To Dictionary ${award.data} id=${tender.data.awards[${award_num}].id} | |
437 | 437 | ${reply}= Call Method ${USERS.users['${username}'].client} patch_award ${tender} ${award} |
438 | 438 | Log ${reply} |
439 | 439 | [Return] ${reply} |
... | ... | @@ -447,7 +447,7 @@ Library openprocurement_client_helper.py |
447 | 447 | [Arguments] ${username} ${tender_uid} ${award_num} |
448 | 448 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uid} |
449 | 449 | ${award}= create_data_dict data.status cancelled |
450 | - Set To Dictionary ${award.data} id ${tender.data.awards[${award_num}].id} | |
450 | + Set To Dictionary ${award.data} id=${tender.data.awards[${award_num}].id} | |
451 | 451 | ${reply}= Call Method ${USERS.users['${username}'].client} patch_award ${tender} ${award} |
452 | 452 | Log ${reply} |
453 | 453 | [Return] ${reply} |
... | ... | @@ -465,7 +465,7 @@ Library openprocurement_client_helper.py |
465 | 465 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} |
466 | 466 | ${data}= test_additional_items_data ${tender['data']['id']} ${tender['access']['token']} |
467 | 467 | Log ${data} |
468 | - Set To Dictionary ${USERS.users['${tender_owner}']} additional_items ${data['data']['items']} | |
468 | + Set To Dictionary ${USERS.users['${tender_owner}']} additional_items=${data['data']['items']} | |
469 | 469 | ${reply}= Call Method ${USERS.users['${username}'].client} patch_tender ${data} |
470 | 470 | Log ${reply} |
471 | 471 | |
... | ... | @@ -527,8 +527,8 @@ Library openprocurement_client_helper.py |
527 | 527 | [Arguments] ${username} ${tender_uaid} ${cancellation_id} ${document_id} ${new_description} |
528 | 528 | ${field}= Set variable description |
529 | 529 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} |
530 | - ${temp}= Create Dictionary ${field} ${new_description} | |
531 | - ${data}= Create Dictionary data ${temp} | |
530 | + ${temp}= Create Dictionary ${field}=${new_description} | |
531 | + ${data}= Create Dictionary data=${temp} | |
532 | 532 | ${reply}= Call Method ${USERS.users['${username}'].client} patch_cancellation_document ${tender} ${data} ${cancellation_id} ${document_id} |
533 | 533 | Log ${reply} |
534 | 534 | |
... | ... | @@ -541,7 +541,7 @@ Library openprocurement_client_helper.py |
541 | 541 | [Arguments] ${username} ${tender_uaid} ${cancel_num} ${doc_num} |
542 | 542 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} |
543 | 543 | ${second_cancel_doc}= create_fake_doc |
544 | - Set To Dictionary ${USERS.users['${tender_owner}']} second_cancel_doc ${second_cancel_doc} | |
544 | + Set To Dictionary ${USERS.users['${tender_owner}']} second_cancel_doc=${second_cancel_doc} | |
545 | 545 | Log ${second_cancel_doc} |
546 | 546 | ${reply}= Call Method ${USERS.users['${username}'].client} update_cancellation_document ${second_cancel_doc} ${tender} ${tender['data']['cancellations'][${cancel_num}]['id']} ${tender['data']['cancellations'][${cancel_num}]['documents'][${doc_num}]['id']} |
547 | 547 | Log ${reply} |
... | ... | @@ -584,7 +584,7 @@ Library openprocurement_client_helper.py |
584 | 584 | [Arguments] ${username} ${tender_uid} ${qualification_num} |
585 | 585 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uid} |
586 | 586 | ${qualification}= create_data_dict data.status active |
587 | - Set To Dictionary ${qualification.data} id ${tender.data.qualifications[${qualification_num}].id} | |
587 | + Set To Dictionary ${qualification.data} id=${tender.data.qualifications[${qualification_num}].id} | |
588 | 588 | ${reply}= Call Method ${USERS.users['${username}'].client} patch_qualification ${tender} ${qualification} |
589 | 589 | Log ${reply} |
590 | 590 | [Return] ${reply} |
... | ... | @@ -598,7 +598,7 @@ Library openprocurement_client_helper.py |
598 | 598 | [Arguments] ${username} ${tender_uid} ${qualification_num} |
599 | 599 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uid} |
600 | 600 | ${qualification}= create_data_dict data.status unsuccessful |
601 | - Set To Dictionary ${qualification.data} id ${tender.data.qualifications[${qualification_num}].id} | |
601 | + Set To Dictionary ${qualification.data} id=${tender.data.qualifications[${qualification_num}].id} | |
602 | 602 | ${reply}= Call Method ${USERS.users['${username}'].client} patch_qualification ${tender} ${qualification} |
603 | 603 | Log ${reply} |
604 | 604 | [Return] ${reply} |
... | ... | @@ -624,7 +624,7 @@ Library openprocurement_client_helper.py |
624 | 624 | [Arguments] ${username} ${tender_uid} ${qualification_num} |
625 | 625 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uid} |
626 | 626 | ${qualification}= create_data_dict data.status cancelled |
627 | - Set To Dictionary ${qualification.data} id ${tender.data.qualifications[${qualification_num}].id} | |
627 | + Set To Dictionary ${qualification.data} id=${tender.data.qualifications[${qualification_num}].id} | |
628 | 628 | ${reply}= Call Method ${USERS.users['${username}'].client} patch_qualification ${tender} ${qualification} |
629 | 629 | Log ${reply} |
630 | 630 | [Return] ${reply} | ... | ... |
... | ... | @@ -183,13 +183,15 @@ Get Broker Property By Username |
183 | 183 | Дочекатись синхронізації з майданчиком |
184 | 184 | [Arguments] ${username} |
185 | 185 | [Documentation] |
186 | - ... Find out how much time has passed since the procurement was modified | |
187 | - ... and store the result in `delta`, | |
188 | - ... then get `timeout_on_wait` for ``username``, | |
189 | - ... then wait for `sleep` seconds, where: | |
190 | - ... | |
191 | - ... sleep = timeout_on_wait - delta | |
192 | - ... | |
186 | + ... Synchronise with ``username`` and update cache | |
187 | + ... First section | |
188 | + ... Get `timeout_on_wait` for ``username`` | |
189 | + ... Add `timeout_on_wait` to `last_modification_date` in order to have | |
190 | + ... correct time of data modification in CDB(every broker has different | |
191 | + ... data synchronisation time with CDB). | |
192 | + ... Find diff between `last_mofidication_date_corrected` | |
193 | + ... and `now`. If that value is positive, sleep for `sleep` seconds, | |
194 | + ... else go to next section. | |
193 | 195 | ... Thus, when this keyword is executed several times in a row, |
194 | 196 | ... it will wait for as long as really needed. |
195 | 197 | ... |
... | ... | @@ -212,18 +214,34 @@ Get Broker Property By Username |
212 | 214 | ... First call will trigger `Sleep 115`. |
213 | 215 | ... Second call will trigger `Sleep 0`, |
214 | 216 | ... since we have already slept for 120 seconds |
215 | - ... and there is no need to sleep any longer. | |
216 | - ${now}= Get Current TZdate | |
217 | - ${delta}= Subtract Date From Date ${now} ${TENDER['LAST_MODIFICATION_DATE']} | |
217 | + ... and there is no need to sleep anymore. | |
218 | + ... | |
219 | + ... Second section | |
220 | + ... Find how much time passed from ``username``'s `last_refresh_date` | |
221 | + ... to `last_modification_date_corrected`. If that value is positive, then | |
222 | + ... cahce for ``username`` is not up-to-date. So, it will be refreshed and | |
223 | + ... `last_refresh_date` will be updated. | |
224 | + ... Else do nothing. | |
218 | 225 | ${timeout_on_wait}= Get Broker Property By Username ${username} timeout_on_wait |
219 | - ${sleep}= Subtract Time From Time ${timeout_on_wait} ${delta} | |
226 | + ${last_modification_date_corrected}= Add Time To Date | |
227 | + ... ${TENDER['LAST_MODIFICATION_DATE']} | |
228 | + ... ${timeout_on_wait} s | |
229 | + ${now}= Get Current TZdate | |
230 | + ${sleep}= Subtract Date From Date | |
231 | + ... ${last_modification_date_corrected} | |
232 | + ... ${now} | |
220 | 233 | Run Keyword If ${sleep} > 0 Sleep ${sleep} |
221 | 234 | |
222 | - ${last_modification_date_corrected}= Add Time To Date ${TENDER['LAST_MODIFICATION_DATE']} ${timeout_on_wait} s | |
223 | - ${time_diff}= Subtract Date From Date ${last_modification_date_corrected} ${USERS.users['${username}']['LAST_REFRESH_DATE']} | |
224 | - Run Keyword If ${time_diff} > 0 Викликати для учасника ${username} Оновити сторінку з тендером ${TENDER['TENDER_UAID']} | |
235 | + | |
236 | + ${time_diff}= Subtract Date From Date | |
237 | + ... ${last_modification_date_corrected} | |
238 | + ... ${USERS.users['${username}']['LAST_REFRESH_DATE']} | |
225 | 239 | ${LAST_REFRESH_DATE}= Get Current TZdate |
226 | - Run Keyword If ${time_diff} > 0 Set To Dictionary ${USERS.users['${username}']} LAST_REFRESH_DATE=${LAST_REFRESH_DATE} | |
240 | + Run Keyword If ${time_diff} > 0 Run keywords | |
241 | + ... Викликати для учасника ${username} Оновити сторінку з тендером ${TENDER['TENDER_UAID']} | |
242 | + ... AND | |
243 | + ... Set To Dictionary ${USERS.users['${username}']} LAST_REFRESH_DATE=${LAST_REFRESH_DATE} | |
244 | + | |
227 | 245 | |
228 | 246 | Звірити поле тендера |
229 | 247 | [Arguments] ${username} ${tender_data} ${field} | ... | ... |
... | ... | @@ -14,8 +14,8 @@ Resource resource.robot |
14 | 14 | ... Створити тендер |
15 | 15 | ... ${tender_data} |
16 | 16 | Log ${tender_data} |
17 | - Set To Dictionary ${TENDER} TENDER_UAID ${TENDER_UAID} | |
18 | - Set To Dictionary ${USERS.users['${tender_owner}']} initial_data ${tender_data} | |
17 | + Set To Dictionary ${TENDER} TENDER_UAID=${TENDER_UAID} | |
18 | + Set To Dictionary ${USERS.users['${tender_owner}']} initial_data=${tender_data} | |
19 | 19 | Log ${TENDER} |
20 | 20 | |
21 | 21 | |
... | ... | @@ -66,8 +66,8 @@ Resource resource.robot |
66 | 66 | ... Створити тендер |
67 | 67 | ... ${tender_data} |
68 | 68 | Log ${tender_data} |
69 | - Set To Dictionary ${TENDER} TENDER_UAID ${TENDER_UAID} | |
70 | - Set To Dictionary ${USERS.users['${tender_owner}']} initial_data ${tender_data} | |
69 | + Set To Dictionary ${TENDER} TENDER_UAID=${TENDER_UAID} | |
70 | + Set To Dictionary ${USERS.users['${tender_owner}']} initial_data=${tender_data} | |
71 | 71 | Log ${TENDER} |
72 | 72 | |
73 | 73 | |
... | ... | @@ -89,8 +89,8 @@ Resource resource.robot |
89 | 89 | ... Завантажити документ |
90 | 90 | ... ${filepath} |
91 | 91 | ... ${TENDER['TENDER_UAID']} |
92 | - ${documents}= Create Dictionary filepath ${filepath} | |
93 | - Set To Dictionary ${USERS.users['${tender_owner}']} documents ${documents} | |
92 | + ${documents}= Create Dictionary filepath=${filepath} | |
93 | + Set To Dictionary ${USERS.users['${tender_owner}']} documents=${documents} | |
94 | 94 | |
95 | 95 | |
96 | 96 | Можливість зареєструвати і підтвердити постачальника до закупівлі | ... | ... |
Please
register
or
login
to post a comment