Commit b7c38414303f13dd0b65b0c11e31d902a62069a0

Authored by AlexDiatlov
1 parent 1660900b

add plan tender testing

... ... @@ -9,6 +9,9 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status":
9 9
10 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 15 ${NUMBER_OF_LOTS}= Convert To Integer ${NUMBER_OF_LOTS}
13 16 ${NUMBER_OF_ITEMS}= Convert To Integer ${NUMBER_OF_ITEMS}
14 17 ${NUMBER_OF_MILESTONES}= Convert To Integer ${NUMBER_OF_MILESTONES}
... ... @@ -25,11 +28,14 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status":
25 28 ... vat_included=${${VAT_INCLUDED}}
26 29 ... road_index=${${ROAD_INDEX}}
27 30 ... gmdn_index=${${GMDN_INDEX}}
  31 + ... plan_tender=${${PLAN_TENDER}}
28 32 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE}
29 33 ${FUNDING_KIND}= Get Variable Value ${FUNDING_KIND}
30 34 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE}
31 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 39 ${adapted_data}= Адаптувати дані для оголошення тендера ${tender_data}
34 40 ${TENDER_UAID}= Run As ${tender_owner} Створити тендер ${adapted_data}
35 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 188 ... number_of_items=${NUMBER_OF_ITEMS}
183 189 ... tender_meat=${${TENDER_MEAT}}
184 190 ... item_meat=${${ITEM_MEAT}}
  191 + ... moz_integration=${${MOZ_INTEGRATION}}
  192 + ... road_index=${${ROAD_INDEX}}
  193 + ... gmdn_index=${${GMDN_INDEX}}
185 194 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE}
186 195 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE}
187 196 ${tender_data}= Підготувати дані для створення плану ${tender_parameters}
... ... @@ -191,6 +200,26 @@ ${ERROR_MESSAGE}= Calling method 'get_tender' failed: ResourceGone: {"status":
191 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 224 :FOR ${username} IN ${tender_owner} ${provider} ${provider1} ${provider2} ${viewer}
196 225 \ Можливість знайти тендер по ідентифікатору для користувача ${username}
... ...
... ... @@ -24,8 +24,8 @@ Library openprocurement_client.utils
24 24 Log Many ${USERS.users['${username}'].id_map}
25 25 ${status}= Run Keyword And Return Status Dictionary Should Contain Key ${USERS.users['${username}'].id_map} ${tender_uaid}
26 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 29 Set To Dictionary ${USERS.users['${username}'].id_map} ${tender_uaid} ${tender_id}
30 30 [return] ${tender_id}
31 31
... ... @@ -69,9 +69,14 @@ Library openprocurement_client.utils
69 69 Log ${auth_ds}
70 70
71 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 80 ${dasu_api_wraper}= prepare_dasu_api_wrapper
76 81 ... ${DASU_RESOURCE}
77 82 ... ${DASU_API_HOST_URL}
... ... @@ -80,7 +85,9 @@ Library openprocurement_client.utils
80 85 ... ${USERS.users['${username}'].auth_dasu[1]}
81 86 ... ${ds_config}
82 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 91 Set To Dictionary ${USERS.users['${username}']} agreement_client=${agreement_wrapper}
85 92 Set To Dictionary ${USERS.users['${username}']} dasu_client=${dasu_api_wraper}
86 93 Set To Dictionary ${USERS.users['${username}']} access_token=${EMPTY}
... ... @@ -183,7 +190,15 @@ Library openprocurement_client.utils
183 190
184 191 Створити тендер
185 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 202 Log ${tender}
188 203 ${access_token}= Get Variable Value ${tender.access.token}
189 204 ${status}= Set Variable If 'open' in '${MODE}' active.tendering ${EMPTY}
... ... @@ -232,10 +247,10 @@ Library openprocurement_client.utils
232 247
233 248 Створити план
234 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 251 Log ${tender}
237 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 254 ... ${tender.data.id}
240 255 ... ${tender}
241 256 ... access_token=${tender.access.token}
... ... @@ -405,7 +420,7 @@ Library openprocurement_client.utils
405 420
406 421 Отримати план по внутрішньому ідентифікатору
407 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 424 ${tender}= set_access_key ${tender} ${USERS.users['${username}'].access_token}
410 425 Set To Dictionary ${USERS.users['${username}']} ${save_key}=${tender}
411 426 ${tender}= munch_dict arg=${tender}
... ... @@ -512,7 +527,7 @@ Library openprocurement_client.utils
512 527 ${tender}= openprocurement_client.Пошук плану по ідентифікатору ${username} ${tender_uaid}
513 528 Set_To_Object ${tender.data} ${fieldname} ${fieldvalue}
514 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 531 ... ${tender.data.id}
517 532 ... ${tender}
518 533 ... access_token=${tender.access.token}
... ... @@ -536,11 +551,12 @@ Library openprocurement_client.utils
536 551 [Arguments] ${username} ${tender_uaid} ${item}
537 552 ${tender}= openprocurement_client.Пошук плану по ідентифікатору ${username} ${tender_uaid}
538 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 555 ... ${tender.data.id}
541 556 ... ${tender}
542 557 ... access_token=${tender.access.token}
543 558
  559 +
544 560 Отримати інформацію із предмету
545 561 [Arguments] ${username} ${tender_uaid} ${item_id} ${field_name}
546 562 ${field_name}= Отримати шлях до поля об’єкта ${username} ${field_name} ${item_id}
... ... @@ -563,7 +579,7 @@ Library openprocurement_client.utils
563 579 ${tender}= openprocurement_client.Пошук плану по ідентифікатору ${username} ${tender_uaid}
564 580 ${item_index}= get_object_index_by_id ${tender.data['items']} ${item_id}
565 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 583 ... ${tender.data.id}
568 584 ... ${tender}
569 585 ... access_token=${tender.access.token}
... ...
... ... @@ -11,6 +11,7 @@ from retrying import retry
11 11 from time import sleep
12 12 import os
13 13 import urllib
  14 +from openprocurement_client.resources.tenders import TenderCreateClient
14 15
15 16
16 17 def retry_if_request_failed(exception):
... ... @@ -182,4 +183,16 @@ class StableClient_dasu(DasuClient):
182 183
183 184
184 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)
\ No newline at end of file
  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)
\ No newline at end of file
... ...
... ... @@ -115,9 +115,11 @@ def subtraction(value1, value2):
115 115 def create_fake_value_amount():
116 116 return fake.random_int(min=1)
117 117
  118 +
118 119 def get_number_of_minutes(days, accelerator):
119 120 return 1440 * int(days) / accelerator
120 121
  122 +
121 123 def field_with_id(prefix, sentence):
122 124 return u"{}-{}: {}".format(prefix, fake.uuid4()[:8], sentence)
123 125
... ... @@ -160,6 +162,7 @@ def create_fake_IsoDurationType(
160 162
161 163
162 164 def test_tender_data(params,
  165 + plan_data,
163 166 periods=("enquiry", "tender"),
164 167 submissionMethodDetails=None,
165 168 funders=None,
... ... @@ -215,7 +218,11 @@ def test_tender_data(params,
215 218 inc_dt += timedelta(minutes=params['intervals'][period_name][i])
216 219 period_dict[period_name + "Period"][j + "Date"] = inc_dt.astimezone(TZ).isoformat()
217 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 226 cpv_group = 336
220 227 elif params.get('road_index'):
221 228 cpv_group = 'road'
... ... @@ -295,10 +302,9 @@ def test_tender_data_planning(params):
295 302 "procuringEntity": {
296 303 "identifier": {
297 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 309 "tender": {
304 310 "procurementMethod": "",
... ... @@ -307,10 +313,22 @@ def test_tender_data_planning(params):
307 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 332 data.update(cpv_data)
315 333 del data['deliveryDate']
316 334 del data['description']
... ... @@ -659,11 +677,11 @@ def test_tender_data_openua_defense(params, submissionMethodDetails):
659 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 681 # We should not provide any values for `enquiryPeriod` when creating
664 682 # an openUA or openEU procedure. That field should not be present at all.
665 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 685 data['procurementMethodType'] = 'aboveThresholdEU'
668 686 data['title_en'] = "[TESTING]"
669 687 for item_number, item in enumerate(data['items']):
... ... @@ -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 213
214 214
215 215 Підготувати дані для створення тендера
216   - [Arguments] ${tender_parameters}
  216 + [Arguments] ${tender_parameters} ${plan_data}
217 217 ${period_intervals}= compute_intrs ${BROKERS} ${used_brokers}
218 218 ${submissionMethodDetails}= Get Variable Value ${submissionMethodDetails}
219 219 ${accelerator}= Get Variable Value ${accelerator}
220 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 222 ${TENDER}= Create Dictionary
223 223 Set Global Variable ${TENDER}
224 224 Log ${tender_data}
... ...
... ... @@ -167,6 +167,10 @@ class OP_Provider(BaseProvider):
167 167 for cpv_element in self.cpvs:
168 168 if cpv_element.startswith(cpv_group):
169 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 174 cpv = self.random_element(similar_cpvs)
171 175 for entity in self.items_base_data:
172 176 if entity["cpv_id"] == cpv:
... ...
... ... @@ -20,6 +20,7 @@ ${MOZ_INTEGRATION} ${False}
20 20 ${VAT_INCLUDED} ${True}
21 21 ${ROAD_INDEX} ${False}
22 22 ${GMDN_INDEX} ${False}
  23 +${PLAN_TENDER} ${True}
23 24
24 25 *** Test Cases ***
25 26 Можливість оголосити тендер
... ...
... ... @@ -11,6 +11,9 @@ ${MODE} belowThreshold
11 11 ${NUMBER_OF_ITEMS} ${2}
12 12 ${TENDER_MEAT} ${False}
13 13 ${ITEM_MEAT} ${False}
  14 +${MOZ_INTEGRATION} ${False}
  15 +${ROAD_INDEX} ${False}
  16 +${GMDN_INDEX} ${False}
14 17
15 18 *** Test Cases ***
16 19 Можливість створити план закупівлі
... ... @@ -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 48 [Tags] ${USERS.users['${viewer}'].broker}: Пошук плану
28 49 ... viewer tender_owner
... ...
... ... @@ -77,7 +77,8 @@ from .initial_data import (
77 77 get_hash,
78 78 invalid_INN_data,
79 79 invalid_cost_data,
80   - invalid_gmdn_data
  80 + invalid_gmdn_data,
  81 + invalid_buyers_data
81 82 )
82 83 from barbecue import chef
83 84 from restkit import request
... ... @@ -320,7 +321,8 @@ def prepare_test_tender_data(procedure_intervals,
320 321 tender_parameters,
321 322 submissionMethodDetails,
322 323 accelerator,
323   - funders):
  324 + funders,
  325 + plan_data):
324 326 # Get actual intervals by mode name
325 327 mode = tender_parameters['mode']
326 328 if mode in procedure_intervals:
... ... @@ -337,35 +339,37 @@ def prepare_test_tender_data(procedure_intervals,
337 339 assert intervals['accelerator'] >= 0, \
338 340 "Accelerator should not be less than 0"
339 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 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 345 elif mode == 'openeu':
344 346 return munchify({'data': test_tender_data_openeu(
345   - tender_parameters, submissionMethodDetails)})
  347 + tender_parameters, submissionMethodDetails, plan_data)})
346 348 elif mode == 'openua':
347 349 return munchify({'data': test_tender_data_openua(
348   - tender_parameters, submissionMethodDetails)})
  350 + tender_parameters, submissionMethodDetails, plan_data)})
349 351 elif mode == 'openua_defense':
350 352 return munchify({'data': test_tender_data_openua_defense(
351   - tender_parameters, submissionMethodDetails)})
  353 + tender_parameters, submissionMethodDetails, plan_data)})
352 354 elif mode == 'open_competitive_dialogue':
353 355 return munchify({'data': test_tender_data_competitive_dialogue(
354   - tender_parameters, submissionMethodDetails)})
  356 + tender_parameters, submissionMethodDetails, plan_data)})
355 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 359 elif mode == 'open_framework':
358 360 return munchify({'data': test_tender_data_framework_agreement(
359   - tender_parameters, submissionMethodDetails)})
  361 + tender_parameters, submissionMethodDetails, plan_data)})
360 362 elif mode == 'belowThreshold':
361 363 return munchify({'data': test_tender_data(
362 364 tender_parameters,
  365 + plan_data,
363 366 submissionMethodDetails=submissionMethodDetails,
364 367 funders=funders,
365   - accelerator=accelerator)})
  368 + accelerator=accelerator,
  369 + )})
366 370 elif mode == 'open_esco':
367 371 return munchify({'data': test_tender_data_esco(
368   - tender_parameters, submissionMethodDetails)})
  372 + tender_parameters, submissionMethodDetails, plan_data)})
369 373 # The previous line needs an explicit keyword argument because,
370 374 # unlike previous functions, this one has three arguments.
371 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 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)
... ...
Please register or login to post a comment