Commit 15779a266af39f55a0b72699f17eec8b93b80886

Authored by selurvedu
1 parent f84fafed

Add a new variable for submissionMethodDetails

This variable can be specified as a command line argument, e.g.
`-v submissionMethodDetails:"quick"`.
If the variable is not set, the `submissionMethodDetails` field
of the initial tender data falls back to its default value – `quick`.

The `test_tender_data_limited` function was not modified because
it ignores `submissionMethodDetails`.
@@ -56,12 +56,16 @@ def create_fake_doc(): @@ -56,12 +56,16 @@ def create_fake_doc():
56 return tf.name.replace('\\', '\\\\'), os.path.basename(tf.name), content 56 return tf.name.replace('\\', '\\\\'), os.path.basename(tf.name), content
57 57
58 58
59 -def test_tender_data(params, periods=("enquiry", "tender")): 59 +def test_tender_data(params,
  60 + periods=("enquiry", "tender"),
  61 + submissionMethodDetails=None):
  62 + submissionMethodDetails = submissionMethodDetails \
  63 + if submissionMethodDetails else "quick"
60 now = get_now() 64 now = get_now()
61 value_amount = round(random.uniform(3000, 99999999999.99), 2) # max value equals to budget of Ukraine in hryvnias 65 value_amount = round(random.uniform(3000, 99999999999.99), 2) # max value equals to budget of Ukraine in hryvnias
62 data = { 66 data = {
63 "mode": "test", 67 "mode": "test",
64 - "submissionMethodDetails": "quick", 68 + "submissionMethodDetails": submissionMethodDetails,
65 "description": fake.description(), 69 "description": fake.description(),
66 "description_en": fake_en.sentence(nb_words=10, variable_nb_words=True), 70 "description_en": fake_en.sentence(nb_words=10, variable_nb_words=True),
67 "description_ru": fake_ru.sentence(nb_words=10, variable_nb_words=True), 71 "description_ru": fake_ru.sentence(nb_words=10, variable_nb_words=True),
@@ -371,21 +375,21 @@ def test_lot_document_data(document, lot_id): @@ -371,21 +375,21 @@ def test_lot_document_data(document, lot_id):
371 return munchify(document) 375 return munchify(document)
372 376
373 377
374 -def test_tender_data_openua(params): 378 +def test_tender_data_openua(params, submissionMethodDetails):
375 # We should not provide any values for `enquiryPeriod` when creating 379 # We should not provide any values for `enquiryPeriod` when creating
376 # an openUA or openEU procedure. That field should not be present at all. 380 # an openUA or openEU procedure. That field should not be present at all.
377 # Therefore, we pass a nondefault list of periods to `test_tender_data()`. 381 # Therefore, we pass a nondefault list of periods to `test_tender_data()`.
378 - data = test_tender_data(params, ('tender',)) 382 + data = test_tender_data(params, ('tender',), submissionMethodDetails)
379 data['procurementMethodType'] = 'aboveThresholdUA' 383 data['procurementMethodType'] = 'aboveThresholdUA'
380 data['procuringEntity']['kind'] = 'general' 384 data['procuringEntity']['kind'] = 'general'
381 return data 385 return data
382 386
383 387
384 -def test_tender_data_openeu(params): 388 +def test_tender_data_openeu(params, submissionMethodDetails):
385 # We should not provide any values for `enquiryPeriod` when creating 389 # We should not provide any values for `enquiryPeriod` when creating
386 # an openUA or openEU procedure. That field should not be present at all. 390 # an openUA or openEU procedure. That field should not be present at all.
387 # Therefore, we pass a nondefault list of periods to `test_tender_data()`. 391 # Therefore, we pass a nondefault list of periods to `test_tender_data()`.
388 - data = test_tender_data(params, ('tender',)) 392 + data = test_tender_data(params, ('tender',), submissionMethodDetails)
389 data['procurementMethodType'] = 'aboveThresholdEU' 393 data['procurementMethodType'] = 'aboveThresholdEU'
390 data['title_en'] = "[TESTING]" 394 data['title_en'] = "[TESTING]"
391 for item_number, item in enumerate(data['items']): 395 for item_number, item in enumerate(data['items']):
@@ -398,11 +402,11 @@ def test_tender_data_openeu(params): @@ -398,11 +402,11 @@ def test_tender_data_openeu(params):
398 return data 402 return data
399 403
400 404
401 -def test_tender_data_competitive_dialogue(params): 405 +def test_tender_data_competitive_dialogue(params, submissionMethodDetails):
402 # We should not provide any values for `enquiryPeriod` when creating 406 # We should not provide any values for `enquiryPeriod` when creating
403 # an openUA or openEU procedure. That field should not be present at all. 407 # an openUA or openEU procedure. That field should not be present at all.
404 # Therefore, we pass a nondefault list of periods to `test_tender_data()`. 408 # Therefore, we pass a nondefault list of periods to `test_tender_data()`.
405 - data = test_tender_data(params, ('tender',)) 409 + data = test_tender_data(params, ('tender',), submissionMethodDetails)
406 if params.get('dialogue_type') == 'UA': 410 if params.get('dialogue_type') == 'UA':
407 data['procurementMethodType'] = 'competitiveDialogueUA' 411 data['procurementMethodType'] = 'competitiveDialogueUA'
408 else: 412 else:
@@ -204,7 +204,8 @@ Get Broker Property By Username @@ -204,7 +204,8 @@ Get Broker Property By Username
204 Підготувати дані для створення тендера 204 Підготувати дані для створення тендера
205 [Arguments] ${tender_parameters} 205 [Arguments] ${tender_parameters}
206 ${period_intervals}= compute_intrs ${BROKERS} ${used_brokers} 206 ${period_intervals}= compute_intrs ${BROKERS} ${used_brokers}
207 - ${tender_data}= prepare_test_tender_data ${period_intervals} ${tender_parameters} 207 + ${submissionMethodDetails}= Get Variable Value ${submissionMethodDetails}
  208 + ${tender_data}= prepare_test_tender_data ${period_intervals} ${tender_parameters} ${submissionMethodDetails}
208 ${TENDER}= Create Dictionary 209 ${TENDER}= Create Dictionary
209 Set Global Variable ${TENDER} 210 Set Global Variable ${TENDER}
210 Log ${tender_data} 211 Log ${tender_data}
@@ -274,7 +274,9 @@ def compute_intrs(brokers_data, used_brokers): @@ -274,7 +274,9 @@ def compute_intrs(brokers_data, used_brokers):
274 return result 274 return result
275 275
276 276
277 -def prepare_test_tender_data(procedure_intervals, tender_parameters): 277 +def prepare_test_tender_data(procedure_intervals,
  278 + tender_parameters,
  279 + submissionMethodDetails):
278 # Get actual intervals by mode name 280 # Get actual intervals by mode name
279 mode = tender_parameters['mode'] 281 mode = tender_parameters['mode']
280 if mode in procedure_intervals: 282 if mode in procedure_intervals:
@@ -295,15 +297,22 @@ def prepare_test_tender_data(procedure_intervals, tender_parameters): @@ -295,15 +297,22 @@ def prepare_test_tender_data(procedure_intervals, tender_parameters):
295 elif mode == 'negotiation.quick': 297 elif mode == 'negotiation.quick':
296 return munchify({'data': test_tender_data_limited(tender_parameters)}) 298 return munchify({'data': test_tender_data_limited(tender_parameters)})
297 elif mode == 'openeu': 299 elif mode == 'openeu':
298 - return munchify({'data': test_tender_data_openeu(tender_parameters)}) 300 + return munchify({'data': test_tender_data_openeu(
  301 + tender_parameters, submissionMethodDetails)})
299 elif mode == 'openua': 302 elif mode == 'openua':
300 - return munchify({'data': test_tender_data_openua(tender_parameters)}) 303 + return munchify({'data': test_tender_data_openua(
  304 + tender_parameters, submissionMethodDetails)})
301 elif mode == 'open_competitive_dialogue': 305 elif mode == 'open_competitive_dialogue':
302 - return munchify({'data': test_tender_data_competitive_dialogue(tender_parameters)}) 306 + return munchify({'data': test_tender_data_competitive_dialogue(
  307 + tender_parameters, submissionMethodDetails)})
303 elif mode == 'reporting': 308 elif mode == 'reporting':
304 return munchify({'data': test_tender_data_limited(tender_parameters)}) 309 return munchify({'data': test_tender_data_limited(tender_parameters)})
305 elif mode == 'belowThreshold': 310 elif mode == 'belowThreshold':
306 - return munchify({'data': test_tender_data(tender_parameters)}) 311 + return munchify({'data': test_tender_data(
  312 + tender_parameters,
  313 + submissionMethodDetails=submissionMethodDetails)})
  314 + # The previous line needs an explicit keyword argument because,
  315 + # unlike previous functions, this one has three arguments.
307 raise ValueError("Invalid mode for prepare_test_tender_data") 316 raise ValueError("Invalid mode for prepare_test_tender_data")
308 317
309 318
Please register or login to post a comment