Commit 15779a266af39f55a0b72699f17eec8b93b80886
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`.
Showing
3 changed files
with
28 additions
and
14 deletions
... | ... | @@ -56,12 +56,16 @@ def create_fake_doc(): |
56 | 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 | 64 | now = get_now() |
61 | 65 | value_amount = round(random.uniform(3000, 99999999999.99), 2) # max value equals to budget of Ukraine in hryvnias |
62 | 66 | data = { |
63 | 67 | "mode": "test", |
64 | - "submissionMethodDetails": "quick", | |
68 | + "submissionMethodDetails": submissionMethodDetails, | |
65 | 69 | "description": fake.description(), |
66 | 70 | "description_en": fake_en.sentence(nb_words=10, variable_nb_words=True), |
67 | 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 | 375 | return munchify(document) |
372 | 376 | |
373 | 377 | |
374 | -def test_tender_data_openua(params): | |
378 | +def test_tender_data_openua(params, submissionMethodDetails): | |
375 | 379 | # We should not provide any values for `enquiryPeriod` when creating |
376 | 380 | # an openUA or openEU procedure. That field should not be present at all. |
377 | 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 | 383 | data['procurementMethodType'] = 'aboveThresholdUA' |
380 | 384 | data['procuringEntity']['kind'] = 'general' |
381 | 385 | return data |
382 | 386 | |
383 | 387 | |
384 | -def test_tender_data_openeu(params): | |
388 | +def test_tender_data_openeu(params, submissionMethodDetails): | |
385 | 389 | # We should not provide any values for `enquiryPeriod` when creating |
386 | 390 | # an openUA or openEU procedure. That field should not be present at all. |
387 | 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 | 393 | data['procurementMethodType'] = 'aboveThresholdEU' |
390 | 394 | data['title_en'] = "[TESTING]" |
391 | 395 | for item_number, item in enumerate(data['items']): |
... | ... | @@ -398,11 +402,11 @@ def test_tender_data_openeu(params): |
398 | 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 | 406 | # We should not provide any values for `enquiryPeriod` when creating |
403 | 407 | # an openUA or openEU procedure. That field should not be present at all. |
404 | 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 | 410 | if params.get('dialogue_type') == 'UA': |
407 | 411 | data['procurementMethodType'] = 'competitiveDialogueUA' |
408 | 412 | else: | ... | ... |
... | ... | @@ -204,7 +204,8 @@ Get Broker Property By Username |
204 | 204 | Підготувати дані для створення тендера |
205 | 205 | [Arguments] ${tender_parameters} |
206 | 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 | 209 | ${TENDER}= Create Dictionary |
209 | 210 | Set Global Variable ${TENDER} |
210 | 211 | Log ${tender_data} | ... | ... |
... | ... | @@ -274,7 +274,9 @@ def compute_intrs(brokers_data, used_brokers): |
274 | 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 | 280 | # Get actual intervals by mode name |
279 | 281 | mode = tender_parameters['mode'] |
280 | 282 | if mode in procedure_intervals: |
... | ... | @@ -295,15 +297,22 @@ def prepare_test_tender_data(procedure_intervals, tender_parameters): |
295 | 297 | elif mode == 'negotiation.quick': |
296 | 298 | return munchify({'data': test_tender_data_limited(tender_parameters)}) |
297 | 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 | 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 | 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 | 308 | elif mode == 'reporting': |
304 | 309 | return munchify({'data': test_tender_data_limited(tender_parameters)}) |
305 | 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 | 316 | raise ValueError("Invalid mode for prepare_test_tender_data") |
308 | 317 | |
309 | 318 | ... | ... |
Please
register
or
login
to post a comment