Commit f337af2e259c9983b2c9fe6bc7988cd2c7b0ceaf

Authored by ivanka12
1 parent 7ba66b82

add test_tender_data_esco method

@@ -19,7 +19,9 @@ Resource resource.robot @@ -19,7 +19,9 @@ Resource resource.robot
19 ... api_host_url=${API_HOST_URL} 19 ... api_host_url=${API_HOST_URL}
20 ... moz_integration=${${MOZ_INTEGRATION}} 20 ... moz_integration=${${MOZ_INTEGRATION}}
21 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE} 21 ${DIALOGUE_TYPE}= Get Variable Value ${DIALOGUE_TYPE}
  22 + ${FUNDING_KIND}= Get Variable Value ${FUNDING_KIND}
22 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE} 23 Run keyword if '${DIALOGUE_TYPE}' != '${None}' Set to dictionary ${tender_parameters} dialogue_type=${DIALOGUE_TYPE}
  24 + Run keyword if '${FUNDING_KIND}' != '${None}' Set to dictionary ${tender_parameters} fundingKind=${FUNDING_KIND}
23 ${tender_data}= Підготувати дані для створення тендера ${tender_parameters} 25 ${tender_data}= Підготувати дані для створення тендера ${tender_parameters}
24 ${adapted_data}= Адаптувати дані для оголошення тендера ${tender_data} 26 ${adapted_data}= Адаптувати дані для оголошення тендера ${tender_data}
25 ${TENDER_UAID}= Run As ${tender_owner} Створити тендер ${adapted_data} 27 ${TENDER_UAID}= Run As ${tender_owner} Створити тендер ${adapted_data}
@@ -680,4 +680,46 @@ def test_elimination_report(corruption, relatedParty_id): @@ -680,4 +680,46 @@ def test_elimination_report(corruption, relatedParty_id):
680 "description": fake_en.sentence(nb_words=10, variable_nb_words=True) 680 "description": fake_en.sentence(nb_words=10, variable_nb_words=True)
681 } 681 }
682 } 682 }
683 - })  
  683 + })
  684 +
  685 +
  686 +def test_tender_data_esco(params, submissionMethodDetails):
  687 + data = test_tender_data(params, ('tender',), submissionMethodDetails)
  688 + data['procurementMethodType'] = 'esco'
  689 + data['title_en'] = "[TESTING]"
  690 + for item_number, item in enumerate(data['items']):
  691 + item['description_en'] = "Test item #{}".format(item_number)
  692 + data['procuringEntity']['name_en'] = fake_en.name()
  693 + data['procuringEntity']['contactPoint']['name_en'] = fake_en.name()
  694 + data['procuringEntity']['contactPoint']['availableLanguage'] = "en"
  695 + data['procuringEntity']['identifier']['legalName_en'] = fake_en.sentence(nb_words=10, variable_nb_words=True)
  696 + data['procuringEntity']['kind'] = 'general'
  697 + data['minimalStepPercentage'] = float(round(random.uniform(0.015, 0.03), 5))
  698 + data['fundingKind'] = params['fundingKind']
  699 + data['NBUdiscountRate'] = float(round(random.uniform(0, 0.99), 5))
  700 + percentage_list = []
  701 + del data["value"]
  702 + del data["minimalStep"]
  703 + for index in range(params['number_of_lots']):
  704 + data['lots'][index]['fundingKind'] = data['fundingKind']
  705 + if index == 0:
  706 + data['lots'][index]['minimalStepPercentage'] = data['minimalStepPercentage']
  707 + else:
  708 + data['lots'][index]['minimalStepPercentage'] = round((float(data['minimalStepPercentage'])-0.0002), 5)
  709 + if data['fundingKind'] == "budget":
  710 + data['lots'][index]['yearlyPaymentsPercentageRange'] = float(round(random.uniform(0.01, 0.8), 5))
  711 + else:
  712 + data['lots'][index]['yearlyPaymentsPercentageRange'] = 0.8
  713 + percentage_list.append(data['lots'][index]['yearlyPaymentsPercentageRange'])
  714 + del data['lots'][index]['value']
  715 + del data['lots'][index]['minimalStep']
  716 + if params['number_of_lots'] == 0:
  717 + if data['fundingKind'] == "budget":
  718 + data['yearlyPaymentsPercentageRange'] = float(round(random.uniform(0.01, 0.8), 3))
  719 + else:
  720 + data['yearlyPaymentsPercentageRange'] = 0.8
  721 + else:
  722 + data['yearlyPaymentsPercentageRange'] = min(percentage_list)
  723 + for index in range(params['number_of_items']):
  724 + del data['items'][index]['deliveryDate']
  725 + return data
@@ -60,6 +60,7 @@ from .initial_data import ( @@ -60,6 +60,7 @@ from .initial_data import (
60 test_conclusion, 60 test_conclusion,
61 test_status_data, 61 test_status_data,
62 test_elimination_report, 62 test_elimination_report,
  63 + test_tender_data_esco,
63 create_fake_title, 64 create_fake_title,
64 create_fake_value_amount, 65 create_fake_value_amount,
65 test_change_document_data, 66 test_change_document_data,
@@ -351,6 +352,9 @@ def prepare_test_tender_data(procedure_intervals, @@ -351,6 +352,9 @@ def prepare_test_tender_data(procedure_intervals,
351 submissionMethodDetails=submissionMethodDetails, 352 submissionMethodDetails=submissionMethodDetails,
352 funders=funders, 353 funders=funders,
353 accelerator=accelerator)}) 354 accelerator=accelerator)})
  355 + elif mode == 'open_esco':
  356 + return munchify({'data': test_tender_data_esco(
  357 + tender_parameters, submissionMethodDetails)})
354 # The previous line needs an explicit keyword argument because, 358 # The previous line needs an explicit keyword argument because,
355 # unlike previous functions, this one has three arguments. 359 # unlike previous functions, this one has three arguments.
356 raise ValueError("Invalid mode for prepare_test_tender_data") 360 raise ValueError("Invalid mode for prepare_test_tender_data")
Please register or login to post a comment