Commit ba9524db3a1528b376327952aaa1f9c35939adc1

Authored by alexdiatlov
Committed by GitHub
2 parents 060432d3 8b85f069

Merge pull request #141 from ProzorroUKR/plan_tender

Plan tender
@@ -9,6 +9,9 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status": @@ -9,6 +9,9 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status":
9 9
10 *** Keywords *** 10 *** Keywords ***
11 Можливість оголосити тендер 11 Можливість оголосити тендер
  12 + ${file_path}= Get Variable Value ${ARTIFACT_FILE} artifact.yaml
  13 + ${ARTIFACT}= load_data_from ${file_path}
  14 + Log ${ARTIFACT.tender_uaid}
12 ${NUMBER_OF_LOTS}= Convert To Integer ${NUMBER_OF_LOTS} 15 ${NUMBER_OF_LOTS}= Convert To Integer ${NUMBER_OF_LOTS}
13 ${NUMBER_OF_ITEMS}= Convert To Integer ${NUMBER_OF_ITEMS} 16 ${NUMBER_OF_ITEMS}= Convert To Integer ${NUMBER_OF_ITEMS}
14 ${NUMBER_OF_MILESTONES}= Convert To Integer ${NUMBER_OF_MILESTONES} 17 ${NUMBER_OF_MILESTONES}= Convert To Integer ${NUMBER_OF_MILESTONES}
@@ -25,11 +28,14 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status": @@ -25,11 +28,14 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status":
25 ... vat_included=${${VAT_INCLUDED}} 28 ... vat_included=${${VAT_INCLUDED}}
26 ... road_index=${${ROAD_INDEX}} 29 ... road_index=${${ROAD_INDEX}}
27 ... gmdn_index=${${GMDN_INDEX}} 30 ... gmdn_index=${${GMDN_INDEX}}
  31 + ... plan_tender=${${PLAN_TENDER}}
28 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE} 32 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE}
29 ${FUNDING_KIND}= Get Variable Value ${FUNDING_KIND} 33 ${FUNDING_KIND}= Get Variable Value ${FUNDING_KIND}
30 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE} 34 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE}
31 Run keyword if '${FUNDING_KIND}' != '${None}' Set to dictionary ${tender_parameters} fundingKind=${FUNDING_KIND} 35 Run keyword if '${FUNDING_KIND}' != '${None}' Set to dictionary ${tender_parameters} fundingKind=${FUNDING_KIND}
32 - ${tender_data}= Підготувати дані для створення тендера ${tender_parameters} 36 + ${plan_data}= Run as ${tender_owner} Пошук плану по ідентифікатору ${ARTIFACT.tender_uaid}
  37 + Log ${plan_data}
  38 + ${tender_data}= Підготувати дані для створення тендера ${tender_parameters} ${plan_data}
33 ${adapted_data}= Адаптувати дані для оголошення тендера ${tender_data} 39 ${adapted_data}= Адаптувати дані для оголошення тендера ${tender_data}
34 ${TENDER_UAID}= Run As ${tender_owner} Створити тендер ${adapted_data} 40 ${TENDER_UAID}= Run As ${tender_owner} Створити тендер ${adapted_data}
35 Set To Dictionary ${USERS.users['${tender_owner}']} initial_data=${adapted_data} 41 Set To Dictionary ${USERS.users['${tender_owner}']} initial_data=${adapted_data}
@@ -182,6 +188,9 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status": @@ -182,6 +188,9 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status":
182 ... number_of_items=${NUMBER_OF_ITEMS} 188 ... number_of_items=${NUMBER_OF_ITEMS}
183 ... tender_meat=${${TENDER_MEAT}} 189 ... tender_meat=${${TENDER_MEAT}}
184 ... item_meat=${${ITEM_MEAT}} 190 ... item_meat=${${ITEM_MEAT}}
  191 + ... moz_integration=${${MOZ_INTEGRATION}}
  192 + ... road_index=${${ROAD_INDEX}}
  193 + ... gmdn_index=${${GMDN_INDEX}}
185 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE} 194 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE}
186 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE} 195 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE}
187 ${tender_data}= Підготувати дані для створення плану ${tender_parameters} 196 ${tender_data}= Підготувати дані для створення плану ${tender_parameters}
@@ -191,6 +200,26 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status": @@ -191,6 +200,26 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status":
191 Set To Dictionary ${TENDER} TENDER_UAID=${TENDER_UAID} 200 Set To Dictionary ${TENDER} TENDER_UAID=${TENDER_UAID}
192 201
193 202
  203 +Можливість створити план закупівлі з використанням валідації для buyers
  204 + [Arguments] ${data_version}
  205 + ${NUMBER_OF_ITEMS}= Convert To Integer ${NUMBER_OF_ITEMS}
  206 + ${tender_parameters}= Create Dictionary
  207 + ... mode=${MODE}
  208 + ... number_of_items=${NUMBER_OF_ITEMS}
  209 + ... tender_meat=${${TENDER_MEAT}}
  210 + ... item_meat=${${ITEM_MEAT}}
  211 + ... moz_integration=${${MOZ_INTEGRATION}}
  212 + ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE}
  213 + Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE}
  214 + ${tender_data}= Підготувати дані для створення плану ${tender_parameters}
  215 + ${adapted_data}= Адаптувати дані для оголошення тендера ${tender_data}
  216 + ${adapted_data_buyers}= edit_plan_buyers ${adapted_data} ${data_version}
  217 + Log ${adapted_data_buyers}
  218 + ${TENDER_UAID}= Run As ${tender_owner} Створити план ${adapted_data_buyers}
  219 + Set To Dictionary ${USERS.users['${tender_owner}']} initial_data=${adapted_data_buyers}
  220 + Set To Dictionary ${TENDER} TENDER_UAID=${TENDER_UAID}
  221 +
  222 +
194 Можливість знайти тендер по ідентифікатору для усіх користувачів 223 Можливість знайти тендер по ідентифікатору для усіх користувачів
195 :FOR ${username} IN ${tender_owner} ${provider} ${provider1} ${provider2} ${viewer} 224 :FOR ${username} IN ${tender_owner} ${provider} ${provider1} ${provider2} ${viewer}
196 \ Можливість знайти тендер по ідентифікатору для користувача ${username} 225 \ Можливість знайти тендер по ідентифікатору для користувача ${username}
@@ -24,8 +24,8 @@ Library openprocurement_client.utils @@ -24,8 +24,8 @@ Library openprocurement_client.utils
24 Log Many ${USERS.users['${username}'].id_map} 24 Log Many ${USERS.users['${username}'].id_map}
25 ${status}= Run Keyword And Return Status Dictionary Should Contain Key ${USERS.users['${username}'].id_map} ${tender_uaid} 25 ${status}= Run Keyword And Return Status Dictionary Should Contain Key ${USERS.users['${username}'].id_map} ${tender_uaid}
26 Run Keyword And Return If ${status} Get From Dictionary ${USERS.users['${username}'].id_map} ${tender_uaid} 26 Run Keyword And Return If ${status} Get From Dictionary ${USERS.users['${username}'].id_map} ${tender_uaid}
27 - Call Method ${USERS.users['${username}'].client} get_plans  
28 - ${tender_id}= Wait Until Keyword Succeeds 5x 30 sec get_plan_id_by_uaid ${tender_uaid} ${USERS.users['${username}'].client} 27 + Call Method ${USERS.users['${username}'].plan_client} get_plans
  28 + ${tender_id}= Wait Until Keyword Succeeds 5x 30 sec get_plan_id_by_uaid ${tender_uaid} ${USERS.users['${username}'].plan_client}
29 Set To Dictionary ${USERS.users['${username}'].id_map} ${tender_uaid} ${tender_id} 29 Set To Dictionary ${USERS.users['${username}'].id_map} ${tender_uaid} ${tender_id}
30 [return] ${tender_id} 30 [return] ${tender_id}
31 31
@@ -69,9 +69,14 @@ Library openprocurement_client.utils @@ -69,9 +69,14 @@ Library openprocurement_client.utils
69 Log ${auth_ds} 69 Log ${auth_ds}
70 70
71 ${ds_config}= Create Dictionary host_url=${ds_host_url} auth_ds=${auth_ds} 71 ${ds_config}= Create Dictionary host_url=${ds_host_url} auth_ds=${auth_ds}
72 - ${api_wrapper}= Run Keyword If '${RESOURCE}' == 'plans'  
73 - ... prepare_plan_api_wrapper ${USERS.users['${username}'].api_key} PLANS ${API_HOST_URL} ${API_VERSION}  
74 - ... ELSE prepare_api_wrapper ${USERS.users['${username}'].api_key} ${RESOURCE} ${API_HOST_URL} ${API_VERSION} ${ds_config} 72 + ${plan_api_wrapper}= prepare_plan_api_wrapper ${USERS.users['${username}'].api_key} PLANS ${API_HOST_URL} ${API_VERSION}
  73 + ${tender_api_wrapper}= prepare_api_wrapper ${USERS.users['${username}'].api_key} TENDERS ${API_HOST_URL} ${API_VERSION} ${ds_config}
  74 + ${tender_create_wrapper}= prepare_tender_create_wrapper
  75 + ... ${USERS.users['${username}'].api_key}
  76 + ... PLANS
  77 + ... ${API_HOST_URL}
  78 + ... ${API_VERSION}
  79 + ... ${ds_config}
75 ${dasu_api_wraper}= prepare_dasu_api_wrapper 80 ${dasu_api_wraper}= prepare_dasu_api_wrapper
76 ... ${DASU_RESOURCE} 81 ... ${DASU_RESOURCE}
77 ... ${DASU_API_HOST_URL} 82 ... ${DASU_API_HOST_URL}
@@ -80,7 +85,9 @@ Library openprocurement_client.utils @@ -80,7 +85,9 @@ Library openprocurement_client.utils
80 ... ${USERS.users['${username}'].auth_dasu[1]} 85 ... ${USERS.users['${username}'].auth_dasu[1]}
81 ... ${ds_config} 86 ... ${ds_config}
82 ${agreement_wrapper}= prepare_agreement_api_wrapper ${USERS.users['${username}'].api_key} AGREEMENTS ${API_HOST_URL} ${API_VERSION} ${ds_config} 87 ${agreement_wrapper}= prepare_agreement_api_wrapper ${USERS.users['${username}'].api_key} AGREEMENTS ${API_HOST_URL} ${API_VERSION} ${ds_config}
83 - Set To Dictionary ${USERS.users['${username}']} client=${api_wrapper} 88 + Set To Dictionary ${USERS.users['${username}']} client=${tender_api_wrapper}
  89 + Set To Dictionary ${USERS.users['${username}']} plan_client=${plan_api_wrapper}
  90 + Set To Dictionary ${USERS.users['${username}']} tender_create_client=${tender_create_wrapper}
84 Set To Dictionary ${USERS.users['${username}']} agreement_client=${agreement_wrapper} 91 Set To Dictionary ${USERS.users['${username}']} agreement_client=${agreement_wrapper}
85 Set To Dictionary ${USERS.users['${username}']} dasu_client=${dasu_api_wraper} 92 Set To Dictionary ${USERS.users['${username}']} dasu_client=${dasu_api_wraper}
86 Set To Dictionary ${USERS.users['${username}']} access_token=${EMPTY} 93 Set To Dictionary ${USERS.users['${username}']} access_token=${EMPTY}
@@ -183,7 +190,15 @@ Library openprocurement_client.utils @@ -183,7 +190,15 @@ Library openprocurement_client.utils
183 190
184 Створити тендер 191 Створити тендер
185 [Arguments] ${username} ${tender_data} 192 [Arguments] ${username} ${tender_data}
186 - ${tender}= Call Method ${USERS.users['${username}'].client} create_tender ${tender_data} 193 + ${file_path}= Get Variable Value ${ARTIFACT_FILE} artifact.yaml
  194 + ${ARTIFACT}= load_data_from ${file_path}
  195 + Log ${ARTIFACT.tender_owner_access_token}
  196 + Log ${ARTIFACT.tender_id}
  197 + ${tender}= Call Method ${USERS.users['${username}'].tender_create_client} create_tender
  198 + ... ${ARTIFACT.tender_id}
  199 + ... ${tender_data}
  200 + ... access_token=${ARTIFACT.tender_owner_access_token}
  201 + #${tender}= Call Method ${USERS.users['${username}'].client} create_tender ${tender_data}
187 Log ${tender} 202 Log ${tender}
188 ${access_token}= Get Variable Value ${tender.access.token} 203 ${access_token}= Get Variable Value ${tender.access.token}
189 ${status}= Set Variable If 'open' in '${MODE}' active.tendering ${EMPTY} 204 ${status}= Set Variable If 'open' in '${MODE}' active.tendering ${EMPTY}
@@ -232,10 +247,10 @@ Library openprocurement_client.utils @@ -232,10 +247,10 @@ Library openprocurement_client.utils
232 247
233 Створити план 248 Створити план
234 [Arguments] ${username} ${tender_data} 249 [Arguments] ${username} ${tender_data}
235 - ${tender}= Call Method ${USERS.users['${username}'].client} create_plan ${tender_data} 250 + ${tender}= Call Method ${USERS.users['${username}'].plan_client} create_plan ${tender_data}
236 Log ${tender} 251 Log ${tender}
237 ${access_token}= Get Variable Value ${tender.access.token} 252 ${access_token}= Get Variable Value ${tender.access.token}
238 - ${tender}= Call Method ${USERS.users['${username}'].client} patch_plan 253 + ${tender}= Call Method ${USERS.users['${username}'].plan_client} patch_plan
239 ... ${tender.data.id} 254 ... ${tender.data.id}
240 ... ${tender} 255 ... ${tender}
241 ... access_token=${tender.access.token} 256 ... access_token=${tender.access.token}
@@ -399,13 +414,13 @@ Library openprocurement_client.utils @@ -399,13 +414,13 @@ Library openprocurement_client.utils
399 414
400 Отримати список планів 415 Отримати список планів
401 [Arguments] ${username} 416 [Arguments] ${username}
402 - @{plans_feed}= get_plans_feed ${USERS.users['${username}'].client} 417 + @{plans_feed}= get_plans_feed ${USERS.users['${username}'].plan_client}
403 [return] @{plans_feed} 418 [return] @{plans_feed}
404 419
405 420
406 Отримати план по внутрішньому ідентифікатору 421 Отримати план по внутрішньому ідентифікатору
407 [Arguments] ${username} ${internalid} ${save_key}=tender_data 422 [Arguments] ${username} ${internalid} ${save_key}=tender_data
408 - ${tender}= Call Method ${USERS.users['${username}'].client} get_plan ${internalid} 423 + ${tender}= Call Method ${USERS.users['${username}'].plan_client} get_plan ${internalid}
409 ${tender}= set_access_key ${tender} ${USERS.users['${username}'].access_token} 424 ${tender}= set_access_key ${tender} ${USERS.users['${username}'].access_token}
410 Set To Dictionary ${USERS.users['${username}']} ${save_key}=${tender} 425 Set To Dictionary ${USERS.users['${username}']} ${save_key}=${tender}
411 ${tender}= munch_dict arg=${tender} 426 ${tender}= munch_dict arg=${tender}
@@ -512,7 +527,7 @@ Library openprocurement_client.utils @@ -512,7 +527,7 @@ Library openprocurement_client.utils
512 ${tender}= openprocurement_client.Пошук плану по ідентифікатору ${username} ${tender_uaid} 527 ${tender}= openprocurement_client.Пошук плану по ідентифікатору ${username} ${tender_uaid}
513 Set_To_Object ${tender.data} ${fieldname} ${fieldvalue} 528 Set_To_Object ${tender.data} ${fieldname} ${fieldvalue}
514 ${tender}= set_access_key ${tender} ${USERS.users['${username}'].access_token} 529 ${tender}= set_access_key ${tender} ${USERS.users['${username}'].access_token}
515 - ${tender}= Call Method ${USERS.users['${username}'].client} patch_plan 530 + ${tender}= Call Method ${USERS.users['${username}'].plan_client} patch_plan
516 ... ${tender.data.id} 531 ... ${tender.data.id}
517 ... ${tender} 532 ... ${tender}
518 ... access_token=${tender.access.token} 533 ... access_token=${tender.access.token}
@@ -536,11 +551,12 @@ Library openprocurement_client.utils @@ -536,11 +551,12 @@ Library openprocurement_client.utils
536 [Arguments] ${username} ${tender_uaid} ${item} 551 [Arguments] ${username} ${tender_uaid} ${item}
537 ${tender}= openprocurement_client.Пошук плану по ідентифікатору ${username} ${tender_uaid} 552 ${tender}= openprocurement_client.Пошук плану по ідентифікатору ${username} ${tender_uaid}
538 Append To List ${tender.data['items']} ${item} 553 Append To List ${tender.data['items']} ${item}
539 - Call Method ${USERS.users['${username}'].client} patch_plan 554 + Call Method ${USERS.users['${username}'].plan_client} patch_plan
540 ... ${tender.data.id} 555 ... ${tender.data.id}
541 ... ${tender} 556 ... ${tender}
542 ... access_token=${tender.access.token} 557 ... access_token=${tender.access.token}
543 558
  559 +
544 Отримати інформацію із предмету 560 Отримати інформацію із предмету
545 [Arguments] ${username} ${tender_uaid} ${item_id} ${field_name} 561 [Arguments] ${username} ${tender_uaid} ${item_id} ${field_name}
546 ${field_name}= Отримати шлях до поля об’єкта ${username} ${field_name} ${item_id} 562 ${field_name}= Отримати шлях до поля об’єкта ${username} ${field_name} ${item_id}
@@ -563,7 +579,7 @@ Library openprocurement_client.utils @@ -563,7 +579,7 @@ Library openprocurement_client.utils
563 ${tender}= openprocurement_client.Пошук плану по ідентифікатору ${username} ${tender_uaid} 579 ${tender}= openprocurement_client.Пошук плану по ідентифікатору ${username} ${tender_uaid}
564 ${item_index}= get_object_index_by_id ${tender.data['items']} ${item_id} 580 ${item_index}= get_object_index_by_id ${tender.data['items']} ${item_id}
565 Remove From List ${tender.data['items']} ${item_index} 581 Remove From List ${tender.data['items']} ${item_index}
566 - Call Method ${USERS.users['${username}'].client} patch_plan 582 + Call Method ${USERS.users['${username}'].plan_client} patch_plan
567 ... ${tender.data.id} 583 ... ${tender.data.id}
568 ... ${tender} 584 ... ${tender}
569 ... access_token=${tender.access.token} 585 ... access_token=${tender.access.token}
@@ -11,6 +11,7 @@ from retrying import retry @@ -11,6 +11,7 @@ from retrying import retry
11 from time import sleep 11 from time import sleep
12 import os 12 import os
13 import urllib 13 import urllib
  14 +from openprocurement_client.resources.tenders import TenderCreateClient
14 15
15 16
16 def retry_if_request_failed(exception): 17 def retry_if_request_failed(exception):
@@ -182,4 +183,16 @@ class StableClient_dasu(DasuClient): @@ -182,4 +183,16 @@ class StableClient_dasu(DasuClient):
182 183
183 184
184 def prepare_dasu_api_wrapper(resource, host_url, api_version, username, password, ds_config=None): 185 def prepare_dasu_api_wrapper(resource, host_url, api_version, username, password, ds_config=None):
185 - return StableClient_dasu(resource, host_url, api_version, username, password, ds_config=ds_config)  
  186 + return StableClient_dasu(resource, host_url, api_version, username, password, ds_config=ds_config)
  187 +
  188 +
  189 +class StableTenderCreateClient(TenderCreateClient):
  190 + @retry(stop_max_attempt_number=100, wait_random_min=500,
  191 + wait_random_max=4000, retry_on_exception=retry_if_request_failed)
  192 + def request(self, *args, **kwargs):
  193 + return super(StableTenderCreateClient, self).request(*args, **kwargs)
  194 +
  195 +
  196 +def prepare_tender_create_wrapper(key, resource, host_url, api_version, ds_config=None):
  197 + return StableTenderCreateClient(key, resource, host_url, api_version,
  198 + ds_config=ds_config)
@@ -10,6 +10,7 @@ ${VAT_INCLUDED} ${True} @@ -10,6 +10,7 @@ ${VAT_INCLUDED} ${True}
10 ${NUMBER_OF_MILESTONES} ${1} 10 ${NUMBER_OF_MILESTONES} ${1}
11 ${ROAD_INDEX} ${False} 11 ${ROAD_INDEX} ${False}
12 ${GMDN_INDEX} ${False} 12 ${GMDN_INDEX} ${False}
  13 +${PLAN_TENDER} ${True}
13 14
14 *** Test Cases *** 15 *** Test Cases ***
15 Можливість оголосити тендер 16 Можливість оголосити тендер
@@ -19,6 +19,7 @@ ${lot_index} ${0} @@ -19,6 +19,7 @@ ${lot_index} ${0}
19 ${award_index} ${0} 19 ${award_index} ${0}
20 ${ROAD_INDEX} ${False} 20 ${ROAD_INDEX} ${False}
21 ${GMDN_INDEX} ${False} 21 ${GMDN_INDEX} ${False}
  22 +${PLAN_TENDER} ${True}
22 23
23 *** Test Cases *** 24 *** Test Cases ***
24 25
@@ -115,9 +115,11 @@ def subtraction(value1, value2): @@ -115,9 +115,11 @@ def subtraction(value1, value2):
115 def create_fake_value_amount(): 115 def create_fake_value_amount():
116 return fake.random_int(min=1) 116 return fake.random_int(min=1)
117 117
  118 +
118 def get_number_of_minutes(days, accelerator): 119 def get_number_of_minutes(days, accelerator):
119 return 1440 * int(days) / accelerator 120 return 1440 * int(days) / accelerator
120 121
  122 +
121 def field_with_id(prefix, sentence): 123 def field_with_id(prefix, sentence):
122 return u"{}-{}: {}".format(prefix, fake.uuid4()[:8], sentence) 124 return u"{}-{}: {}".format(prefix, fake.uuid4()[:8], sentence)
123 125
@@ -160,6 +162,7 @@ def create_fake_IsoDurationType( @@ -160,6 +162,7 @@ def create_fake_IsoDurationType(
160 162
161 163
162 def test_tender_data(params, 164 def test_tender_data(params,
  165 + plan_data,
163 periods=("enquiry", "tender"), 166 periods=("enquiry", "tender"),
164 submissionMethodDetails=None, 167 submissionMethodDetails=None,
165 funders=None, 168 funders=None,
@@ -215,7 +218,11 @@ def test_tender_data(params, @@ -215,7 +218,11 @@ def test_tender_data(params,
215 inc_dt += timedelta(minutes=params['intervals'][period_name][i]) 218 inc_dt += timedelta(minutes=params['intervals'][period_name][i])
216 period_dict[period_name + "Period"][j + "Date"] = inc_dt.astimezone(TZ).isoformat() 219 period_dict[period_name + "Period"][j + "Date"] = inc_dt.astimezone(TZ).isoformat()
217 data.update(period_dict) 220 data.update(period_dict)
218 - if params.get('moz_integration'): 221 + if params.get('plan_tender'):
  222 + data["procuringEntity"]["name"] = plan_data["data"]["procuringEntity"]["name"]
  223 + data["procuringEntity"]["identifier"] = plan_data["data"]["procuringEntity"]["identifier"]
  224 + cpv_group = plan_data["data"]["classification"]["id"]
  225 + elif params.get('moz_integration'):
219 cpv_group = 336 226 cpv_group = 336
220 elif params.get('road_index'): 227 elif params.get('road_index'):
221 cpv_group = 'road' 228 cpv_group = 'road'
@@ -295,10 +302,9 @@ def test_tender_data_planning(params): @@ -295,10 +302,9 @@ def test_tender_data_planning(params):
295 "procuringEntity": { 302 "procuringEntity": {
296 "identifier": { 303 "identifier": {
297 "scheme": "UA-EDR", 304 "scheme": "UA-EDR",
298 - "id": str(fake.random_int(min=1, max=999)),  
299 - "legalName": fake.description(), 305 + "id": random.choice(["13313462", "00037256"]),
  306 + "legalName": random.choice([u"Київський Тестовий Ліцей", u"Київська Тестова міська клінічна лікарня"]),
300 }, 307 },
301 - "name": fake.description(),  
302 }, 308 },
303 "tender": { 309 "tender": {
304 "procurementMethod": "", 310 "procurementMethod": "",
@@ -307,10 +313,22 @@ def test_tender_data_planning(params): @@ -307,10 +313,22 @@ def test_tender_data_planning(params):
307 "startDate": get_now().replace(hour=0, minute=0, second=0, microsecond=0).isoformat() 313 "startDate": get_now().replace(hour=0, minute=0, second=0, microsecond=0).isoformat()
308 } 314 }
309 }, 315 },
310 - "items": [] 316 + "items": [],
  317 + "buyers": []
311 } 318 }
312 - id_cpv=fake.cpv()[:4]  
313 - cpv_data=test_item_data(id_cpv) 319 + data["procuringEntity"]["name"] = data["procuringEntity"]["identifier"]["legalName"]
  320 + buyers = test_buyers_data()
  321 + buyers["name"] = buyers["identifier"]["legalName"]
  322 + data['buyers'].append(buyers)
  323 + if params.get('moz_integration'):
  324 + id_cpv = 336
  325 + elif params.get('road_index'):
  326 + id_cpv = 'road'
  327 + elif params.get('gmdn_index'):
  328 + id_cpv = 'gmdn'
  329 + else:
  330 + id_cpv = fake.cpv()[:4]
  331 + cpv_data = test_item_data(id_cpv)
314 data.update(cpv_data) 332 data.update(cpv_data)
315 del data['deliveryDate'] 333 del data['deliveryDate']
316 del data['description'] 334 del data['description']
@@ -334,8 +352,8 @@ def test_tender_data_planning(params): @@ -334,8 +352,8 @@ def test_tender_data_planning(params):
334 return munchify(data) 352 return munchify(data)
335 353
336 354
337 -def test_tender_data_limited(params):  
338 - data = test_tender_data(params) 355 +def test_tender_data_limited(params, plan_data):
  356 + data = test_tender_data(params, plan_data)
339 del data["submissionMethodDetails"] 357 del data["submissionMethodDetails"]
340 del data["minimalStep"] 358 del data["minimalStep"]
341 del data["enquiryPeriod"] 359 del data["enquiryPeriod"]
@@ -639,31 +657,31 @@ def test_change_document_data(document, change_id): @@ -639,31 +657,31 @@ def test_change_document_data(document, change_id):
639 return munchify(document) 657 return munchify(document)
640 658
641 659
642 -def test_tender_data_openua(params, submissionMethodDetails): 660 +def test_tender_data_openua(params, submissionMethodDetails, plan_data):
643 # We should not provide any values for `enquiryPeriod` when creating 661 # We should not provide any values for `enquiryPeriod` when creating
644 # an openUA or openEU procedure. That field should not be present at all. 662 # an openUA or openEU procedure. That field should not be present at all.
645 # Therefore, we pass a nondefault list of periods to `test_tender_data()`. 663 # Therefore, we pass a nondefault list of periods to `test_tender_data()`.
646 - data = test_tender_data(params, ('tender',), submissionMethodDetails) 664 + data = test_tender_data(params, plan_data, ('tender',), submissionMethodDetails)
647 data['procurementMethodType'] = 'aboveThresholdUA' 665 data['procurementMethodType'] = 'aboveThresholdUA'
648 data['procuringEntity']['kind'] = 'general' 666 data['procuringEntity']['kind'] = 'general'
649 return data 667 return data
650 668
651 669
652 -def test_tender_data_openua_defense(params, submissionMethodDetails): 670 +def test_tender_data_openua_defense(params, submissionMethodDetails, plan_data):
653 """We should not provide any values for `enquiryPeriod` when creating 671 """We should not provide any values for `enquiryPeriod` when creating
654 an openUA, openEU or openUA_defense procedure. That field should not be present at all. 672 an openUA, openEU or openUA_defense procedure. That field should not be present at all.
655 Therefore, we pass a nondefault list of periods to `test_tender_data()`.""" 673 Therefore, we pass a nondefault list of periods to `test_tender_data()`."""
656 - data = test_tender_data(params, ('tender',), submissionMethodDetails) 674 + data = test_tender_data(params, plan_data, ('tender',), submissionMethodDetails)
657 data['procurementMethodType'] = 'aboveThresholdUA.defense' 675 data['procurementMethodType'] = 'aboveThresholdUA.defense'
658 data['procuringEntity']['kind'] = 'defense' 676 data['procuringEntity']['kind'] = 'defense'
659 return data 677 return data
660 678
661 679
662 -def test_tender_data_openeu(params, submissionMethodDetails): 680 +def test_tender_data_openeu(params, submissionMethodDetails, plan_data):
663 # We should not provide any values for `enquiryPeriod` when creating 681 # We should not provide any values for `enquiryPeriod` when creating
664 # an openUA or openEU procedure. That field should not be present at all. 682 # an openUA or openEU procedure. That field should not be present at all.
665 # Therefore, we pass a nondefault list of periods to `test_tender_data()`. 683 # Therefore, we pass a nondefault list of periods to `test_tender_data()`.
666 - data = test_tender_data(params, ('tender',), submissionMethodDetails) 684 + data = test_tender_data(params, plan_data, ('tender',), submissionMethodDetails)
667 data['procurementMethodType'] = 'aboveThresholdEU' 685 data['procurementMethodType'] = 'aboveThresholdEU'
668 data['title_en'] = "[TESTING]" 686 data['title_en'] = "[TESTING]"
669 for item_number, item in enumerate(data['items']): 687 for item_number, item in enumerate(data['items']):
@@ -676,8 +694,8 @@ def test_tender_data_openeu(params, submissionMethodDetails): @@ -676,8 +694,8 @@ def test_tender_data_openeu(params, submissionMethodDetails):
676 return data 694 return data
677 695
678 696
679 -def test_tender_data_framework_agreement(params, submissionMethodDetails):  
680 - data = test_tender_data_openeu(params, submissionMethodDetails) 697 +def test_tender_data_framework_agreement(params, submissionMethodDetails, plan_data):
  698 + data = test_tender_data_openeu(params, submissionMethodDetails, plan_data)
681 data['procurementMethodType'] = 'closeFrameworkAgreementUA' 699 data['procurementMethodType'] = 'closeFrameworkAgreementUA'
682 data['maxAwardsCount'] = fake.random_int(min=3, max=5) 700 data['maxAwardsCount'] = fake.random_int(min=3, max=5)
683 data['agreementDuration'] = create_fake_IsoDurationType( 701 data['agreementDuration'] = create_fake_IsoDurationType(
@@ -691,11 +709,11 @@ def test_tender_data_framework_agreement(params, submissionMethodDetails): @@ -691,11 +709,11 @@ def test_tender_data_framework_agreement(params, submissionMethodDetails):
691 return data 709 return data
692 710
693 711
694 -def test_tender_data_competitive_dialogue(params, submissionMethodDetails): 712 +def test_tender_data_competitive_dialogue(params, submissionMethodDetails, plan_data):
695 # We should not provide any values for `enquiryPeriod` when creating 713 # We should not provide any values for `enquiryPeriod` when creating
696 # an openUA or openEU procedure. That field should not be present at all. 714 # an openUA or openEU procedure. That field should not be present at all.
697 # Therefore, we pass a nondefault list of periods to `test_tender_data()`. 715 # Therefore, we pass a nondefault list of periods to `test_tender_data()`.
698 - data = test_tender_data(params, ('tender',), submissionMethodDetails) 716 + data = test_tender_data(params, plan_data, ('tender',), submissionMethodDetails)
699 if params.get('dialogue_type') == 'UA': 717 if params.get('dialogue_type') == 'UA':
700 data['procurementMethodType'] = 'competitiveDialogueUA' 718 data['procurementMethodType'] = 'competitiveDialogueUA'
701 else: 719 else:
@@ -843,8 +861,8 @@ def test_elimination_report(corruption, relatedParty_id): @@ -843,8 +861,8 @@ def test_elimination_report(corruption, relatedParty_id):
843 }) 861 })
844 862
845 863
846 -def test_tender_data_esco(params, submissionMethodDetails):  
847 - data = test_tender_data(params, ('tender',), submissionMethodDetails) 864 +def test_tender_data_esco(params, submissionMethodDetails, plan_data):
  865 + data = test_tender_data(params, ('tender',), submissionMethodDetails, plan_data)
848 data['procurementMethodType'] = 'esco' 866 data['procurementMethodType'] = 'esco'
849 data['title_en'] = "[TESTING]" 867 data['title_en'] = "[TESTING]"
850 for item_number, item in enumerate(data['items']): 868 for item_number, item in enumerate(data['items']):
@@ -931,3 +949,24 @@ def invalid_gmdn_data(): @@ -931,3 +949,24 @@ def invalid_gmdn_data():
931 }) 949 })
932 950
933 951
  952 +def test_buyers_data():
  953 + buyers = {
  954 + "identifier": {
  955 + "scheme": "UA-EDR",
  956 + "id": random.choice(["13313462", "00037256"]),
  957 + "legalName": random.choice([u"Київський Тестовий Ліцей", u"Київська Тестова міська клінічна лікарня"]),
  958 + }
  959 + }
  960 + return munchify(buyers)
  961 +
  962 +
  963 +def invalid_buyers_data():
  964 + buyers = {
  965 + "identifier": {
  966 + "scheme": "UA-EDR",
  967 + "id": "13313462",
  968 + "legalName": "Київський Тестовий Ліцей",
  969 + },
  970 + "name": "Київський Тестовий Ліцей"
  971 + }
  972 + return munchify(buyers)
@@ -213,12 +213,12 @@ Get Broker Property By Username @@ -213,12 +213,12 @@ Get Broker Property By Username
213 213
214 214
215 Підготувати дані для створення тендера 215 Підготувати дані для створення тендера
216 - [Arguments] ${tender_parameters} 216 + [Arguments] ${tender_parameters} ${plan_data}
217 ${period_intervals}= compute_intrs ${BROKERS} ${used_brokers} 217 ${period_intervals}= compute_intrs ${BROKERS} ${used_brokers}
218 ${submissionMethodDetails}= Get Variable Value ${submissionMethodDetails} 218 ${submissionMethodDetails}= Get Variable Value ${submissionMethodDetails}
219 ${accelerator}= Get Variable Value ${accelerator} 219 ${accelerator}= Get Variable Value ${accelerator}
220 ${funders}= Get Variable Value ${FUNDERS} 220 ${funders}= Get Variable Value ${FUNDERS}
221 - ${tender_data}= prepare_test_tender_data ${period_intervals} ${tender_parameters} ${submissionMethodDetails} ${accelerator} ${funders} 221 + ${tender_data}= prepare_test_tender_data ${period_intervals} ${tender_parameters} ${submissionMethodDetails} ${accelerator} ${funders} ${plan_data}
222 ${TENDER}= Create Dictionary 222 ${TENDER}= Create Dictionary
223 Set Global Variable ${TENDER} 223 Set Global Variable ${TENDER}
224 Log ${tender_data} 224 Log ${tender_data}
@@ -18,6 +18,7 @@ ${MOZ_INTEGRATION} ${False} @@ -18,6 +18,7 @@ ${MOZ_INTEGRATION} ${False}
18 ${VAT_INCLUDED} ${True} 18 ${VAT_INCLUDED} ${True}
19 ${ROAD_INDEX} ${False} 19 ${ROAD_INDEX} ${False}
20 ${GMDN_INDEX} ${False} 20 ${GMDN_INDEX} ${False}
  21 +${PLAN_TENDER} ${True}
21 22
22 *** Test Cases *** 23 *** Test Cases ***
23 ############################################################################################## 24 ##############################################################################################
@@ -18,6 +18,7 @@ ${MOZ_INTEGRATION} ${False} @@ -18,6 +18,7 @@ ${MOZ_INTEGRATION} ${False}
18 ${VAT_INCLUDED} ${True} 18 ${VAT_INCLUDED} ${True}
19 ${ROAD_INDEX} ${False} 19 ${ROAD_INDEX} ${False}
20 ${GMDN_INDEX} ${False} 20 ${GMDN_INDEX} ${False}
  21 +${PLAN_TENDER} ${True}
21 22
22 *** Test Cases *** 23 *** Test Cases ***
23 ############################################################################################## 24 ##############################################################################################
@@ -167,6 +167,10 @@ class OP_Provider(BaseProvider): @@ -167,6 +167,10 @@ class OP_Provider(BaseProvider):
167 for cpv_element in self.cpvs: 167 for cpv_element in self.cpvs:
168 if cpv_element.startswith(cpv_group): 168 if cpv_element.startswith(cpv_group):
169 similar_cpvs.append(cpv_element) 169 similar_cpvs.append(cpv_element)
  170 + else:
  171 + for cpv_element in self.moz_cpvs:
  172 + if cpv_element.startswith(cpv_group):
  173 + similar_cpvs.append(cpv_element)
170 cpv = self.random_element(similar_cpvs) 174 cpv = self.random_element(similar_cpvs)
171 for entity in self.items_base_data: 175 for entity in self.items_base_data:
172 if entity["cpv_id"] == cpv: 176 if entity["cpv_id"] == cpv:
@@ -20,6 +20,7 @@ ${MOZ_INTEGRATION} ${False} @@ -20,6 +20,7 @@ ${MOZ_INTEGRATION} ${False}
20 ${VAT_INCLUDED} ${True} 20 ${VAT_INCLUDED} ${True}
21 ${ROAD_INDEX} ${False} 21 ${ROAD_INDEX} ${False}
22 ${GMDN_INDEX} ${False} 22 ${GMDN_INDEX} ${False}
  23 +${PLAN_TENDER} ${True}
23 24
24 *** Test Cases *** 25 *** Test Cases ***
25 Можливість оголосити тендер 26 Можливість оголосити тендер
@@ -11,6 +11,9 @@ ${MODE} belowThreshold @@ -11,6 +11,9 @@ ${MODE} belowThreshold
11 ${NUMBER_OF_ITEMS} ${2} 11 ${NUMBER_OF_ITEMS} ${2}
12 ${TENDER_MEAT} ${False} 12 ${TENDER_MEAT} ${False}
13 ${ITEM_MEAT} ${False} 13 ${ITEM_MEAT} ${False}
  14 +${MOZ_INTEGRATION} ${False}
  15 +${ROAD_INDEX} ${False}
  16 +${GMDN_INDEX} ${False}
14 17
15 *** Test Cases *** 18 *** Test Cases ***
16 Можливість створити план закупівлі 19 Можливість створити план закупівлі
@@ -23,6 +26,24 @@ ${ITEM_MEAT} ${False} @@ -23,6 +26,24 @@ ${ITEM_MEAT} ${False}
23 Можливість створити план закупівлі 26 Можливість створити план закупівлі
24 27
25 28
  29 +Можливість створити план закупівлі з двома buyers
  30 + [Tags] ${USERS.users['${tender_owner}'].broker}: Оголошення плану
  31 + ... tender_owner
  32 + ... ${USERS.users['${tender_owner}'].broker}
  33 + ... create_plan_two_buyers
  34 + ... critical
  35 + Run Keyword And Expect Error * Можливість створити план закупівлі з використанням валідації для buyers ${1}
  36 +
  37 +
  38 +Можливість створити план закупівлі з порожнім buyers
  39 + [Tags] ${USERS.users['${tender_owner}'].broker}: Оголошення плану
  40 + ... tender_owner
  41 + ... ${USERS.users['${tender_owner}'].broker}
  42 + ... create_plan_no_buyers
  43 + ... critical
  44 + Run Keyword And Expect Error * Можливість створити план закупівлі з використанням валідації для buyers ${2}
  45 +
  46 +
26 Можливість знайти план по ідентифікатору 47 Можливість знайти план по ідентифікатору
27 [Tags] ${USERS.users['${viewer}'].broker}: Пошук плану 48 [Tags] ${USERS.users['${viewer}'].broker}: Пошук плану
28 ... viewer tender_owner 49 ... viewer tender_owner
@@ -18,6 +18,7 @@ ${MOZ_INTEGRATION} ${False} @@ -18,6 +18,7 @@ ${MOZ_INTEGRATION} ${False}
18 ${VAT_INCLUDED} ${True} 18 ${VAT_INCLUDED} ${True}
19 ${ROAD_INDEX} ${False} 19 ${ROAD_INDEX} ${False}
20 ${GMDN_INDEX} ${False} 20 ${GMDN_INDEX} ${False}
  21 +${PLAN_TENDER} ${True}
21 22
22 *** Test Cases *** 23 *** Test Cases ***
23 ############################################################################################## 24 ##############################################################################################
@@ -77,7 +77,8 @@ from .initial_data import ( @@ -77,7 +77,8 @@ from .initial_data import (
77 get_hash, 77 get_hash,
78 invalid_INN_data, 78 invalid_INN_data,
79 invalid_cost_data, 79 invalid_cost_data,
80 - invalid_gmdn_data 80 + invalid_gmdn_data,
  81 + invalid_buyers_data
81 ) 82 )
82 from barbecue import chef 83 from barbecue import chef
83 from restkit import request 84 from restkit import request
@@ -320,7 +321,8 @@ def prepare_test_tender_data(procedure_intervals, @@ -320,7 +321,8 @@ def prepare_test_tender_data(procedure_intervals,
320 tender_parameters, 321 tender_parameters,
321 submissionMethodDetails, 322 submissionMethodDetails,
322 accelerator, 323 accelerator,
323 - funders): 324 + funders,
  325 + plan_data):
324 # Get actual intervals by mode name 326 # Get actual intervals by mode name
325 mode = tender_parameters['mode'] 327 mode = tender_parameters['mode']
326 if mode in procedure_intervals: 328 if mode in procedure_intervals:
@@ -337,35 +339,37 @@ def prepare_test_tender_data(procedure_intervals, @@ -337,35 +339,37 @@ def prepare_test_tender_data(procedure_intervals,
337 assert intervals['accelerator'] >= 0, \ 339 assert intervals['accelerator'] >= 0, \
338 "Accelerator should not be less than 0" 340 "Accelerator should not be less than 0"
339 if mode == 'negotiation': 341 if mode == 'negotiation':
340 - return munchify({'data': test_tender_data_limited(tender_parameters)}) 342 + return munchify({'data': test_tender_data_limited(tender_parameters, plan_data)})
341 elif mode == 'negotiation.quick': 343 elif mode == 'negotiation.quick':
342 - return munchify({'data': test_tender_data_limited(tender_parameters)}) 344 + return munchify({'data': test_tender_data_limited(tender_parameters, plan_data)})
343 elif mode == 'openeu': 345 elif mode == 'openeu':
344 return munchify({'data': test_tender_data_openeu( 346 return munchify({'data': test_tender_data_openeu(
345 - tender_parameters, submissionMethodDetails)}) 347 + tender_parameters, submissionMethodDetails, plan_data)})
346 elif mode == 'openua': 348 elif mode == 'openua':
347 return munchify({'data': test_tender_data_openua( 349 return munchify({'data': test_tender_data_openua(
348 - tender_parameters, submissionMethodDetails)}) 350 + tender_parameters, submissionMethodDetails, plan_data)})
349 elif mode == 'openua_defense': 351 elif mode == 'openua_defense':
350 return munchify({'data': test_tender_data_openua_defense( 352 return munchify({'data': test_tender_data_openua_defense(
351 - tender_parameters, submissionMethodDetails)}) 353 + tender_parameters, submissionMethodDetails, plan_data)})
352 elif mode == 'open_competitive_dialogue': 354 elif mode == 'open_competitive_dialogue':
353 return munchify({'data': test_tender_data_competitive_dialogue( 355 return munchify({'data': test_tender_data_competitive_dialogue(
354 - tender_parameters, submissionMethodDetails)}) 356 + tender_parameters, submissionMethodDetails, plan_data)})
355 elif mode == 'reporting': 357 elif mode == 'reporting':
356 - return munchify({'data': test_tender_data_limited(tender_parameters)}) 358 + return munchify({'data': test_tender_data_limited(tender_parameters, plan_data)})
357 elif mode == 'open_framework': 359 elif mode == 'open_framework':
358 return munchify({'data': test_tender_data_framework_agreement( 360 return munchify({'data': test_tender_data_framework_agreement(
359 - tender_parameters, submissionMethodDetails)}) 361 + tender_parameters, submissionMethodDetails, plan_data)})
360 elif mode == 'belowThreshold': 362 elif mode == 'belowThreshold':
361 return munchify({'data': test_tender_data( 363 return munchify({'data': test_tender_data(
362 tender_parameters, 364 tender_parameters,
  365 + plan_data,
363 submissionMethodDetails=submissionMethodDetails, 366 submissionMethodDetails=submissionMethodDetails,
364 funders=funders, 367 funders=funders,
365 - accelerator=accelerator)}) 368 + accelerator=accelerator,
  369 + )})
366 elif mode == 'open_esco': 370 elif mode == 'open_esco':
367 return munchify({'data': test_tender_data_esco( 371 return munchify({'data': test_tender_data_esco(
368 - tender_parameters, submissionMethodDetails)}) 372 + tender_parameters, submissionMethodDetails, plan_data)})
369 # The previous line needs an explicit keyword argument because, 373 # The previous line needs an explicit keyword argument because,
370 # unlike previous functions, this one has three arguments. 374 # unlike previous functions, this one has three arguments.
371 raise ValueError("Invalid mode for prepare_test_tender_data") 375 raise ValueError("Invalid mode for prepare_test_tender_data")
@@ -750,3 +754,13 @@ def edit_tender_data_for_gmdn(data, mode, data_version): @@ -750,3 +754,13 @@ def edit_tender_data_for_gmdn(data, mode, data_version):
750 return munchify(dict_data) 754 return munchify(dict_data)
751 755
752 756
  757 +def edit_plan_buyers(data, data_version):
  758 + dict_data = unmunchify(data)
  759 + if data_version is 1:
  760 + add_buyer = invalid_buyers_data()
  761 + dict_data['data']['buyers'].append(add_buyer)
  762 +
  763 + if data_version is 2:
  764 + dict_data['data'].pop('buyers')
  765 +
  766 + return munchify(dict_data)
  1 +-v MODE:belowThreshold
  2 +
  3 +-v NUMBER_OF_ITEMS:2
  4 +
  5 +-v TENDER_MEAT:False
  6 +-v ITEM_MEAT:False
  7 +-v LOT_MEAT:False
  8 +
  9 +-i create_plan
  10 +-i find_plan
  11 +
  12 +-i plan_view
  13 +
  14 +-i modify_plan
  15 +
  16 +-i add_item
  17 +-i delete_item
Please register or login to post a comment