Commit 1fb4722f4f52031bc0a31524d9f3fce292a97615

Authored by godsdog
2 parents 4f9a8dd7 328ad111

Merge branch 'ds-master' into devel

@@ -14,6 +14,7 @@ recipe = zc.recipe.egg @@ -14,6 +14,7 @@ recipe = zc.recipe.egg
14 eggs = 14 eggs =
15 op_robot_tests 15 op_robot_tests
16 openprocurement_client 16 openprocurement_client
  17 + restkit
17 robotframework 18 robotframework
18 robotframework-lint 19 robotframework-lint
19 robotframework-debuglibrary 20 robotframework-debuglibrary
@@ -57,7 +58,7 @@ gh_push = git@github.com: @@ -57,7 +58,7 @@ gh_push = git@github.com:
57 58
58 [sources] 59 [sources]
59 barbecue = git ${remotes:gh}openprocurement/barbecue.git 60 barbecue = git ${remotes:gh}openprocurement/barbecue.git
60 -openprocurement_client = git ${remotes:gh}openprocurement/openprocurement.client.python.git 61 +openprocurement_client = git ${remotes:gh}openprocurement/openprocurement.client.python.git branch=use_requests
61 robot_tests.broker.alltenders = git ${remotes:gh}openprocurement/robot_tests.broker.alltenders.git 62 robot_tests.broker.alltenders = git ${remotes:gh}openprocurement/robot_tests.broker.alltenders.git
62 robot_tests.broker.dzo = git ${remotes:gh}openprocurement/robot_tests.broker.dzo.git 63 robot_tests.broker.dzo = git ${remotes:gh}openprocurement/robot_tests.broker.dzo.git
63 robot_tests.broker.25h8 = git ${remotes:gh}openprocurement/robot_tests.broker.25h8.git 64 robot_tests.broker.25h8 = git ${remotes:gh}openprocurement/robot_tests.broker.25h8.git
@@ -16,6 +16,7 @@ Resource resource.robot @@ -16,6 +16,7 @@ Resource resource.robot
16 ... tender_meat=${${TENDER_MEAT}} 16 ... tender_meat=${${TENDER_MEAT}}
17 ... lot_meat=${${LOT_MEAT}} 17 ... lot_meat=${${LOT_MEAT}}
18 ... item_meat=${${ITEM_MEAT}} 18 ... item_meat=${${ITEM_MEAT}}
  19 + ... api_host_url=${API_HOST_URL}
19 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE} 20 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE}
20 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE} 21 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE}
21 ${tender_data}= Підготувати дані для створення тендера ${tender_parameters} 22 ${tender_data}= Підготувати дані для створення тендера ${tender_parameters}
1 *** Settings *** 1 *** Settings ***
2 Library openprocurement_client_helper.py 2 Library openprocurement_client_helper.py
  3 +Library openprocurement_client.utils
3 4
4 5
5 *** Keywords *** 6 *** Keywords ***
@@ -18,10 +19,20 @@ Library openprocurement_client_helper.py @@ -18,10 +19,20 @@ Library openprocurement_client_helper.py
18 19
19 Підготувати клієнт для користувача 20 Підготувати клієнт для користувача
20 [Arguments] ${username} 21 [Arguments] ${username}
21 - [Documentation] Відкрити браузер, створити об’єкт api wrapper, створити об’єкт edr_wrapper, тощо 22 + [Documentation] Відкрити браузер, створити об’єкти api wrapper і
  23 + ... ds api wrapper, приєднати їх атрибутами до користувача, тощо
  24 + Log ${RESOURCE}
22 Log ${API_HOST_URL} 25 Log ${API_HOST_URL}
23 Log ${API_VERSION} 26 Log ${API_VERSION}
24 - ${api_wrapper}= prepare_api_wrapper ${USERS.users['${username}'].api_key} ${API_HOST_URL} ${API_VERSION} 27 + Log ${DS_HOST_URL}
  28 + ${auth_ds_all}= get variable value ${USERS.users.${username}.auth_ds}
  29 + ${auth_ds}= set variable ${auth_ds_all.${RESOURCE}}
  30 + Log ${auth_ds}
  31 +
  32 +# Uncomment this line if there is need to precess files operations without DS.
  33 +# ${ds_api_wraper}= set variable ${None}
  34 + ${ds_api_wraper}= prepare_ds_api_wrapper ${DS_HOST_URL} ${auth_ds}
  35 + ${api_wrapper}= prepare_api_wrapper ${USERS.users['${username}'].api_key} ${RESOURCE} ${API_HOST_URL} ${API_VERSION} ${ds_api_wraper}
25 Set To Dictionary ${USERS.users['${username}']} client=${api_wrapper} 36 Set To Dictionary ${USERS.users['${username}']} client=${api_wrapper}
26 Set To Dictionary ${USERS.users['${username}']} access_token=${EMPTY} 37 Set To Dictionary ${USERS.users['${username}']} access_token=${EMPTY}
27 ${id_map}= Create Dictionary 38 ${id_map}= Create Dictionary
@@ -38,11 +49,11 @@ Library openprocurement_client_helper.py @@ -38,11 +49,11 @@ Library openprocurement_client_helper.py
38 Log ${tender_uaid} 49 Log ${tender_uaid}
39 Log ${filepath} 50 Log ${filepath}
40 ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} 51 ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid}
41 - ${tender}= set_access_key ${tender} ${USERS.users['${username}'].access_token} 52 + ${tender}= set_access_key ${tender} ${USERS.users['${username}'].access_token}
42 ${reply}= Call Method ${USERS.users['${username}'].client} upload_document ${filepath} ${tender} 53 ${reply}= Call Method ${USERS.users['${username}'].client} upload_document ${filepath} ${tender}
43 Log object data ${reply} reply 54 Log object data ${reply} reply
44 #return here is needed to have uploaded doc data in `Завантажити документ в лот` keyword 55 #return here is needed to have uploaded doc data in `Завантажити документ в лот` keyword
45 - [return] ${reply} 56 + [return] ${reply}
46 57
47 58
48 Отримати інформацію із документа 59 Отримати інформацію із документа
@@ -773,13 +784,13 @@ Library openprocurement_client_helper.py @@ -773,13 +784,13 @@ Library openprocurement_client_helper.py
773 784
774 785
775 Змінити документ в ставці 786 Змінити документ в ставці
776 - [Arguments] ${username} ${tender_uaid} ${path} ${doc_id} 787 + [Arguments] ${username} ${tender_uaid} ${path} ${doc_id} ${doc_type}=documents
777 ${bid_id}= Get Variable Value ${USERS.users['${username}'].bidresponses['bid'].data.id} 788 ${bid_id}= Get Variable Value ${USERS.users['${username}'].bidresponses['bid'].data.id}
778 ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} 789 ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid}
779 ${tender}= set_access_key ${tender} ${USERS.users['${username}']['access_token']} 790 ${tender}= set_access_key ${tender} ${USERS.users['${username}']['access_token']}
780 ${bid}= openprocurement_client.Отримати пропозицію ${username} ${tender_uaid} 791 ${bid}= openprocurement_client.Отримати пропозицію ${username} ${tender_uaid}
781 ${bid_doc}= get_document_by_id ${bid.data} ${doc_id} 792 ${bid_doc}= get_document_by_id ${bid.data} ${doc_id}
782 - ${response}= Call Method ${USERS.users['${username}'].client} update_bid_document ${path} ${tender} ${bid_id} ${bid_doc['id']} 793 + ${response}= Call Method ${USERS.users['${username}'].client} update_bid_document ${path} ${tender} ${bid_id} ${bid_doc['id']} ${doc_type}
783 ${uploaded_file} = Create Dictionary 794 ${uploaded_file} = Create Dictionary
784 ... filepath=${path} 795 ... filepath=${path}
785 ... upload_response=${response} 796 ... upload_response=${response}
1 from openprocurement_client.client import Client, EDRClient 1 from openprocurement_client.client import Client, EDRClient
2 -from openprocurement_client.utils import get_tender_id_by_uaid 2 +from openprocurement_client.document_service_client \
  3 + import DocumentServiceClient
3 from openprocurement_client.exceptions import IdNotFound 4 from openprocurement_client.exceptions import IdNotFound
4 from restkit.errors import RequestFailed, BadStatusLine 5 from restkit.errors import RequestFailed, BadStatusLine
5 from retrying import retry 6 from retrying import retry
@@ -19,13 +20,26 @@ def retry_if_request_failed(exception): @@ -19,13 +20,26 @@ def retry_if_request_failed(exception):
19 20
20 21
21 class StableClient(Client): 22 class StableClient(Client):
22 - @retry(stop_max_attempt_number=100, wait_random_min=500, wait_random_max=4000, retry_on_exception=retry_if_request_failed) 23 + @retry(stop_max_attempt_number=100, wait_random_min=500,
  24 + wait_random_max=4000, retry_on_exception=retry_if_request_failed)
23 def request(self, *args, **kwargs): 25 def request(self, *args, **kwargs):
24 return super(StableClient, self).request(*args, **kwargs) 26 return super(StableClient, self).request(*args, **kwargs)
25 27
26 28
27 -def prepare_api_wrapper(key, host_url, api_version):  
28 - return StableClient(key, host_url, api_version) 29 +class StableDsClient(DocumentServiceClient):
  30 + @retry(stop_max_attempt_number=100, wait_random_min=500,
  31 + wait_random_max=4000, retry_on_exception=retry_if_request_failed)
  32 + def request(self, *args, **kwargs):
  33 + return super(StableDsClient, self).request(*args, **kwargs)
  34 +
  35 +
  36 +def prepare_api_wrapper(key, resource, host_url, api_version, ds_client=None):
  37 + return StableClient(key, resource, host_url, api_version,
  38 + ds_client=ds_client)
  39 +
  40 +
  41 +def prepare_ds_api_wrapper(ds_host_url, auth_ds):
  42 + return StableDsClient(ds_host_url, auth_ds)
29 43
30 44
31 class StableEDRClient(EDRClient): 45 class StableEDRClient(EDRClient):
@@ -151,9 +151,9 @@ ztv: @@ -151,9 +151,9 @@ ztv:
151 keywords_file: ztv 151 keywords_file: ztv
152 roles: 152 roles:
153 tender_owner: ztv_Owner 153 tender_owner: ztv_Owner
154 - provider: ztv_Provider  
155 - provider1: ztv_Provider1  
156 - viewer: ztv_Viewer 154 + provider: ztv_Provider
  155 + provider1: ztv_Provider1
  156 + viewer: ztv_Viewer
157 timeout_on_wait: 300 157 timeout_on_wait: 300
158 Newtend: 158 Newtend:
159 keywords_file: newtend 159 keywords_file: newtend
1 users: 1 users:
2 Tender_Owner: 2 Tender_Owner:
  3 + auth_ds:
  4 + tenders: [test.quintagroup.com, test.quintagroup.com]
  5 + auctions: [test.quintagroup.com, bc698baa8b814908bc75405ed3d63548]
3 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3 6 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3
4 broker: Quinta 7 broker: Quinta
5 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62] 8 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62]
6 Tender_User: 9 Tender_User:
  10 + auth_ds:
  11 + tenders: [test.quintagroup.com, test.quintagroup.com]
  12 + auctions: [test.quintagroup.com, bc698baa8b814908bc75405ed3d63548]
7 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3 13 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3
8 broker: Quinta 14 broker: Quinta
9 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62] 15 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62]
10 Tender_User1: 16 Tender_User1:
  17 + auth_ds:
  18 + tenders: [test.quintagroup.com, test.quintagroup.com]
  19 + auctions: [test.quintagroup.com, bc698baa8b814908bc75405ed3d63548]
11 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3 20 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3
12 broker: Quinta 21 broker: Quinta
13 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62] 22 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62]
14 Tender_User2: 23 Tender_User2:
  24 + auth_ds:
  25 + tenders: [test.quintagroup.com, test.quintagroup.com]
  26 + auctions: [test.quintagroup.com, bc698baa8b814908bc75405ed3d63548]
15 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3 27 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3
16 broker: Quinta 28 broker: Quinta
17 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62] 29 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62]
18 Tender_Viewer: 30 Tender_Viewer:
  31 + auth_ds:
  32 + tenders: [test.quintagroup.com, test.quintagroup.com]
  33 + auctions: [test.quintagroup.com, bc698baa8b814908bc75405ed3d63548]
19 api_key: "" 34 api_key: ""
20 broker: Quinta 35 broker: Quinta
21 browser: firefox 36 browser: firefox
@@ -49,7 +49,7 @@ Set Suite Variable With Default Value @@ -49,7 +49,7 @@ Set Suite Variable With Default Value
49 ${repo}= Run git remote -v 49 ${repo}= Run git remote -v
50 ${branch}= Run git branch -vva 50 ${branch}= Run git branch -vva
51 ${status}= Run git status 51 ${status}= Run git status
52 - ${diff}= Run git diff 52 + ${diff}= Run git diff
53 ${reflog}= Run git reflog 53 ${reflog}= Run git reflog
54 Log ${commit} 54 Log ${commit}
55 Log ${repo} 55 Log ${repo}
1 *** Variables *** 1 *** Variables ***
  2 +${RESOURCE} tenders # possible values: tenders, auctions
2 ${API_HOST_URL} https://lb.api-sandbox.openprocurement.org 3 ${API_HOST_URL} https://lb.api-sandbox.openprocurement.org
3 ${API_VERSION} 2.3 4 ${API_VERSION} 2.3
4 ${BROKER} Quinta 5 ${BROKER} Quinta
  6 +${DS_HOST_URL} https://upload.docs-sandbox.openprocurement.org
5 ${ROLE} viewer 7 ${ROLE} viewer
6 ${EDR_HOST_URL} https://lb.edr-sandbox.openprocurement.org 8 ${EDR_HOST_URL} https://lb.edr-sandbox.openprocurement.org
7 ${EDR_VERSION} 0 9 ${EDR_VERSION} 0
Please register or login to post a comment