Commit 1fb4722f4f52031bc0a31524d9f3fce292a97615

Authored by godsdog
2 parents 4f9a8dd7 328ad111

Merge branch 'ds-master' into devel

... ... @@ -14,6 +14,7 @@ recipe = zc.recipe.egg
14 14 eggs =
15 15 op_robot_tests
16 16 openprocurement_client
  17 + restkit
17 18 robotframework
18 19 robotframework-lint
19 20 robotframework-debuglibrary
... ... @@ -57,7 +58,7 @@ gh_push = git@github.com:
57 58
58 59 [sources]
59 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 62 robot_tests.broker.alltenders = git ${remotes:gh}openprocurement/robot_tests.broker.alltenders.git
62 63 robot_tests.broker.dzo = git ${remotes:gh}openprocurement/robot_tests.broker.dzo.git
63 64 robot_tests.broker.25h8 = git ${remotes:gh}openprocurement/robot_tests.broker.25h8.git
... ...
... ... @@ -16,6 +16,7 @@ Resource resource.robot
16 16 ... tender_meat=${${TENDER_MEAT}}
17 17 ... lot_meat=${${LOT_MEAT}}
18 18 ... item_meat=${${ITEM_MEAT}}
  19 + ... api_host_url=${API_HOST_URL}
19 20 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE}
20 21 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE}
21 22 ${tender_data}= Підготувати дані для створення тендера ${tender_parameters}
... ...
1 1 *** Settings ***
2 2 Library openprocurement_client_helper.py
  3 +Library openprocurement_client.utils
3 4
4 5
5 6 *** Keywords ***
... ... @@ -18,10 +19,20 @@ Library openprocurement_client_helper.py
18 19
19 20 Підготувати клієнт для користувача
20 21 [Arguments] ${username}
21   - [Documentation] Відкрити браузер, створити об’єкт api wrapper, створити об’єкт edr_wrapper, тощо
  22 + [Documentation] Відкрити браузер, створити об’єкти api wrapper і
  23 + ... ds api wrapper, приєднати їх атрибутами до користувача, тощо
  24 + Log ${RESOURCE}
22 25 Log ${API_HOST_URL}
23 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 36 Set To Dictionary ${USERS.users['${username}']} client=${api_wrapper}
26 37 Set To Dictionary ${USERS.users['${username}']} access_token=${EMPTY}
27 38 ${id_map}= Create Dictionary
... ... @@ -38,11 +49,11 @@ Library openprocurement_client_helper.py
38 49 Log ${tender_uaid}
39 50 Log ${filepath}
40 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 53 ${reply}= Call Method ${USERS.users['${username}'].client} upload_document ${filepath} ${tender}
43 54 Log object data ${reply} reply
44 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 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 788 ${bid_id}= Get Variable Value ${USERS.users['${username}'].bidresponses['bid'].data.id}
778 789 ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid}
779 790 ${tender}= set_access_key ${tender} ${USERS.users['${username}']['access_token']}
780 791 ${bid}= openprocurement_client.Отримати пропозицію ${username} ${tender_uaid}
781 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 794 ${uploaded_file} = Create Dictionary
784 795 ... filepath=${path}
785 796 ... upload_response=${response}
... ...
1 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 4 from openprocurement_client.exceptions import IdNotFound
4 5 from restkit.errors import RequestFailed, BadStatusLine
5 6 from retrying import retry
... ... @@ -19,13 +20,26 @@ def retry_if_request_failed(exception):
19 20
20 21
21 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 25 def request(self, *args, **kwargs):
24 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 45 class StableEDRClient(EDRClient):
... ...
... ... @@ -151,9 +151,9 @@ ztv:
151 151 keywords_file: ztv
152 152 roles:
153 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 157 timeout_on_wait: 300
158 158 Newtend:
159 159 keywords_file: newtend
... ...
1 1 users:
2 2 Tender_Owner:
  3 + auth_ds:
  4 + tenders: [test.quintagroup.com, test.quintagroup.com]
  5 + auctions: [test.quintagroup.com, bc698baa8b814908bc75405ed3d63548]
3 6 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3
4 7 broker: Quinta
5 8 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62]
6 9 Tender_User:
  10 + auth_ds:
  11 + tenders: [test.quintagroup.com, test.quintagroup.com]
  12 + auctions: [test.quintagroup.com, bc698baa8b814908bc75405ed3d63548]
7 13 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3
8 14 broker: Quinta
9 15 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62]
10 16 Tender_User1:
  17 + auth_ds:
  18 + tenders: [test.quintagroup.com, test.quintagroup.com]
  19 + auctions: [test.quintagroup.com, bc698baa8b814908bc75405ed3d63548]
11 20 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3
12 21 broker: Quinta
13 22 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62]
14 23 Tender_User2:
  24 + auth_ds:
  25 + tenders: [test.quintagroup.com, test.quintagroup.com]
  26 + auctions: [test.quintagroup.com, bc698baa8b814908bc75405ed3d63548]
15 27 api_key: e9c3ccb8e8124f26941d5f9639a4ebc3
16 28 broker: Quinta
17 29 auth_edr: [test.quintagroup.com, f5111c99a97a45348d8165ba8fcf0d62]
18 30 Tender_Viewer:
  31 + auth_ds:
  32 + tenders: [test.quintagroup.com, test.quintagroup.com]
  33 + auctions: [test.quintagroup.com, bc698baa8b814908bc75405ed3d63548]
19 34 api_key: ""
20 35 broker: Quinta
21 36 browser: firefox
... ...
... ... @@ -49,7 +49,7 @@ Set Suite Variable With Default Value
49 49 ${repo}= Run git remote -v
50 50 ${branch}= Run git branch -vva
51 51 ${status}= Run git status
52   - ${diff}= Run git diff
  52 + ${diff}= Run git diff
53 53 ${reflog}= Run git reflog
54 54 Log ${commit}
55 55 Log ${repo}
... ...
1 1 *** Variables ***
  2 +${RESOURCE} tenders # possible values: tenders, auctions
2 3 ${API_HOST_URL} https://lb.api-sandbox.openprocurement.org
3 4 ${API_VERSION} 2.3
4 5 ${BROKER} Quinta
  6 +${DS_HOST_URL} https://upload.docs-sandbox.openprocurement.org
5 7 ${ROLE} viewer
6 8 ${EDR_HOST_URL} https://lb.edr-sandbox.openprocurement.org
7 9 ${EDR_VERSION} 0
\ No newline at end of file
... ...
Please register or login to post a comment