Commit a9789d54b637fb92b170afed8651827dd6ffde07

Authored by selurvedu
2 parents bab40975 f1c32386

Merge pull request #98 from Leits/client

op_client: Switch to new get_tender_id_by_uaid()

This fixes the following bug when using openprocurement_client broker:
Only recently changed tenders could be found by UAID.

Conflicts:
	op_robot_tests/tests_files/brokers/openprocurement_client.robot
@@ -10,13 +10,9 @@ Library openprocurement_client_helper.py @@ -10,13 +10,9 @@ Library openprocurement_client_helper.py
10 Log Many ${ID_MAP} 10 Log Many ${ID_MAP}
11 ${status}= Run Keyword And Return Status Dictionary Should Contain Key ${ID_MAP} ${tender_uaid} 11 ${status}= Run Keyword And Return Status Dictionary Should Contain Key ${ID_MAP} ${tender_uaid}
12 Run Keyword And Return If ${status} Get From Dictionary ${ID_MAP} ${tender_uaid} 12 Run Keyword And Return If ${status} Get From Dictionary ${ID_MAP} ${tender_uaid}
13 - ${tenders}= get_tenders ${USERS.users['${username}'].client}  
14 - Log Many @{tenders}  
15 - :FOR ${tender} IN @{tenders}  
16 - \ Set To Dictionary ${ID_MAP} ${tender.tenderID}=${tender.id}  
17 - Log Many ${ID_MAP}  
18 - Dictionary Should Contain Key ${ID_MAP} ${tender_uaid}  
19 - Run Keyword And Return Get From Dictionary ${ID_MAP} ${tender_uaid} 13 + ${tender_id}= get_tender_id_by_uaid ${tender_uaid} ${USERS.users['${username}'].client}
  14 + Set To Dictionary ${ID_MAP} ${tender_uaid} ${tender_id}
  15 + [return] ${tender_id}
20 16
21 17
22 Підготувати клієнт для користувача 18 Підготувати клієнт для користувача
1 from openprocurement_client.client import Client 1 from openprocurement_client.client import Client
  2 +from openprocurement_client.utils import get_tender_id_by_uaid
2 3
3 4
4 def prepare_api_wrapper(key, host_url, api_version): 5 def prepare_api_wrapper(key, host_url, api_version):
5 return Client(key, host_url, api_version) 6 return Client(key, host_url, api_version)
6 -  
7 -  
8 -def get_tenders(client, offset=None):  
9 - params = {'opt_fields': 'tenderID', 'descending': 1}  
10 - if offset:  
11 - params['offset'] = offset  
12 - return client.get_tenders(params)  
Please register or login to post a comment