Commit d13a0dc06c2209fe0c761121998f16a024b0cab1
1 parent
0d372117
Support new method of tender list retrieval
Showing
2 changed files
with
19 additions
and
15 deletions
... | ... | @@ -8,23 +8,25 @@ Library Selenium2Screenshots |
8 | 8 | [Documentation] |
9 | 9 | ... ${ARGUMENTS[0]} == username |
10 | 10 | ... ${ARGUMENTS[1]} == tenderid |
11 | - log many @{ARGUMENTS} | |
12 | - ${tenders}= get_internal_id ${USERS.users['${ARGUMENTS[0]}'].client.get_tenders} ${USERS.users['${ARGUMENTS[0]}'].creation_date} | |
11 | + Log Many @{ARGUMENTS} | |
12 | + Log Many ${ID_MAP} | |
13 | + ${status}= Run Keyword And Return Status Dictionary Should Contain Key ${ID_MAP} ${ARGUMENTS[1]} | |
14 | + Run Keyword And Return If ${status} Get From Dictionary ${ID_MAP} ${ARGUMENTS[1]} | |
15 | + ${tenders}= get_tenders ${USERS.users['${ARGUMENTS[0]}'].client} | |
16 | + Log Many @{tenders} | |
13 | 17 | :FOR ${tender} IN @{tenders} |
14 | - \ log ${tender} | |
15 | - \ ${internal_id}= Run Keyword And Return If '${tender.tenderID}' == '${ARGUMENTS[1]}' Get Variable Value ${tender.id} | |
16 | - \ Exit For Loop If '${tender.tenderID}' == '${ARGUMENTS[1]}' | |
17 | - log ${internal_id} | |
18 | - log ${tenders} | |
19 | - [return] ${internal_id} | |
18 | + \ Set To Dictionary ${ID_MAP} ${tender.tenderID} ${tender.id} | |
19 | + Log Many ${ID_MAP} | |
20 | + Dictionary Should Contain Key ${ID_MAP} ${ARGUMENTS[1]} | |
21 | + Run Keyword And Return Get From Dictionary ${ID_MAP} ${ARGUMENTS[1]} | |
20 | 22 | |
21 | 23 | Підготувати клієнт для користувача |
22 | 24 | [Arguments] @{ARGUMENTS} |
23 | 25 | [Documentation] Відкрити брaвзер, створити обєкт api wrapper, тощо |
24 | - ${api_wrapper}= prepare_api_wrapper ${USERS.users['${ARGUMENTS[0]}'].api_key} ${API_HOST_URL} ${api_version} | |
25 | - ${creation_date} = get_date | |
26 | - Set To Dictionary ${USERS.users['${ARGUMENTS[0]}']} creation_date ${creation_date} | |
27 | - Set To Dictionary ${USERS.users['${ARGUMENTS[0]}']} client ${api_wrapper} | |
26 | + ${api_wrapper}= prepare_api_wrapper ${USERS.users['${ARGUMENTS[0]}'].api_key} ${API_HOST_URL} ${api_version} | |
27 | + Set To Dictionary ${USERS.users['${ARGUMENTS[0]}']} client ${api_wrapper} | |
28 | + ${ID_MAP}= Create Dictionary | |
29 | + Set Suite Variable ${ID_MAP} | |
28 | 30 | Log Variables |
29 | 31 | |
30 | 32 | Підготувати дані для оголошення тендера | ... | ... |
... | ... | @@ -6,6 +6,8 @@ def prepare_api_wrapper(key='', host_url="https://api-sandbox.openprocurement.or |
6 | 6 | return Client(key, host_url, api_version) |
7 | 7 | |
8 | 8 | |
9 | -def get_internal_id(get_tenders_function, date): | |
10 | - result = get_tenders_function({"offset": date, "opt_fields": 'tenderID'}) | |
11 | - return result | |
9 | +def get_tenders(client, offset=None): | |
10 | + params = {'opt_fields': 'tenderID', 'descending': 1} | |
11 | + if offset: | |
12 | + params['offset'] = offset | |
13 | + return client.get_tenders(params) | ... | ... |
Please
register
or
login
to post a comment