Commit 42cd942810b9dc832b04fa82048f0a7e474f3dc9

Authored by Leits
1 parent ca63d4f7

Add accelerator to all procedure

@@ -25,11 +25,12 @@ Default: @@ -25,11 +25,12 @@ Default:
25 # Second number in list: Duration of period (for endDate) 25 # Second number in list: Duration of period (for endDate)
26 enquiry: [0, 11] 26 enquiry: [0, 11]
27 tender: [0, 31] 27 tender: [0, 31]
28 - openua:  
29 # accelerator: Integer value 28 # accelerator: Integer value
30 # This is not a name of period 29 # This is not a name of period
31 # Please refer to API documentation to find out what's this 30 # Please refer to API documentation to find out what's this
32 accelerator: 1440 31 accelerator: 1440
  32 + openua:
  33 + accelerator: 1440
33 tender: [0, 15] 34 tender: [0, 15]
34 # Please remember that openUA and openEU procedures 35 # Please remember that openUA and openEU procedures
35 # forbid anyone to set or modify enquiryPeriod 36 # forbid anyone to set or modify enquiryPeriod
@@ -72,6 +72,9 @@ def test_tender_data(params, periods=("enquiry", "tender")): @@ -72,6 +72,9 @@ def test_tender_data(params, periods=("enquiry", "tender")):
72 "items": [], 72 "items": [],
73 "features": [] 73 "features": []
74 } 74 }
  75 + accelerator = params['intervals']['accelerator']
  76 + data['procurementMethodDetails'] = 'quick, ' \
  77 + 'accelerator={}'.format(accelerator)
75 data["procuringEntity"]["kind"] = "other" 78 data["procuringEntity"]["kind"] = "other"
76 if data.get("mode") == "test": 79 if data.get("mode") == "test":
77 data["title"] = u"[ТЕСТУВАННЯ] {}".format(data["title"]) 80 data["title"] = u"[ТЕСТУВАННЯ] {}".format(data["title"])
@@ -144,14 +147,12 @@ def test_tender_data_limited(params): @@ -144,14 +147,12 @@ def test_tender_data_limited(params):
144 "stateLegalServices" 147 "stateLegalServices"
145 ) 148 )
146 cause = fake.random_element(cause_variants) 149 cause = fake.random_element(cause_variants)
147 - data.update({"cause": cause})  
148 - if params['mode'] == "negotiation.quick": 150 + elif params['mode'] == "negotiation.quick":
149 cause_variants = ('quick',) 151 cause_variants = ('quick',)
150 - cause = fake.random_element(cause_variants)  
151 - data.update({"cause": cause})  
152 if params['mode'] in ("negotiation", "negotiation.quick"): 152 if params['mode'] in ("negotiation", "negotiation.quick"):
  153 + cause = fake.random_element(cause_variants)
153 data.update({ 154 data.update({
154 - "procurementMethodDetails": "quick, accelerator=1440", 155 + "cause": cause,
155 "causeDescription": fake.description() 156 "causeDescription": fake.description()
156 }) 157 })
157 return munchify(data) 158 return munchify(data)
@@ -350,33 +351,21 @@ def test_lot_document_data(document, lot_id): @@ -350,33 +351,21 @@ def test_lot_document_data(document, lot_id):
350 351
351 352
352 def test_tender_data_openua(params): 353 def test_tender_data_openua(params):
353 - accelerator = params['intervals']['accelerator']  
354 - # Since `accelerator` field is not really a list containing timings  
355 - # for a period called `acceleratorPeriod`, let's remove it :)  
356 - del params['intervals']['accelerator']  
357 # We should not provide any values for `enquiryPeriod` when creating 354 # We should not provide any values for `enquiryPeriod` when creating
358 # an openUA or openEU procedure. That field should not be present at all. 355 # an openUA or openEU procedure. That field should not be present at all.
359 # Therefore, we pass a nondefault list of periods to `test_tender_data()`. 356 # Therefore, we pass a nondefault list of periods to `test_tender_data()`.
360 data = test_tender_data(params, ('tender',)) 357 data = test_tender_data(params, ('tender',))
361 data['procurementMethodType'] = 'aboveThresholdUA' 358 data['procurementMethodType'] = 'aboveThresholdUA'
362 - data['procurementMethodDetails'] = 'quick, ' \  
363 - 'accelerator={}'.format(accelerator)  
364 data['procuringEntity']['kind'] = 'general' 359 data['procuringEntity']['kind'] = 'general'
365 return data 360 return data
366 361
367 362
368 def test_tender_data_openeu(params): 363 def test_tender_data_openeu(params):
369 - accelerator = params['intervals']['accelerator']  
370 - # Since `accelerator` field is not really a list containing timings  
371 - # for a period called `acceleratorPeriod`, let's remove it :)  
372 - del params['intervals']['accelerator']  
373 # We should not provide any values for `enquiryPeriod` when creating 364 # We should not provide any values for `enquiryPeriod` when creating
374 # an openUA or openEU procedure. That field should not be present at all. 365 # an openUA or openEU procedure. That field should not be present at all.
375 # Therefore, we pass a nondefault list of periods to `test_tender_data()`. 366 # Therefore, we pass a nondefault list of periods to `test_tender_data()`.
376 data = test_tender_data(params, ('tender',)) 367 data = test_tender_data(params, ('tender',))
377 data['procurementMethodType'] = 'aboveThresholdEU' 368 data['procurementMethodType'] = 'aboveThresholdEU'
378 - data['procurementMethodDetails'] = 'quick, ' \  
379 - 'accelerator={}'.format(accelerator)  
380 data['title_en'] = "[TESTING]" 369 data['title_en'] = "[TESTING]"
381 for item_number, item in enumerate(data['items']): 370 for item_number, item in enumerate(data['items']):
382 item['description_en'] = "Test item #{}".format(item_number) 371 item['description_en'] = "Test item #{}".format(item_number)
@@ -272,16 +272,11 @@ def prepare_test_tender_data(procedure_intervals, tender_parameters): @@ -272,16 +272,11 @@ def prepare_test_tender_data(procedure_intervals, tender_parameters):
272 tender_parameters['intervals'] = intervals 272 tender_parameters['intervals'] = intervals
273 273
274 # Set acceleration value for certain modes 274 # Set acceleration value for certain modes
275 - if mode in ['openua', 'openeu']:  
276 - assert isinstance(intervals['accelerator'], int), \  
277 - "Accelerator should be an 'int', " \  
278 - "not '{}'".format(type(intervals['accelerator']).__name__)  
279 - assert intervals['accelerator'] >= 0, \  
280 - "Accelerator should not be less than 0"  
281 - else:  
282 - assert 'accelerator' not in intervals.keys(), \  
283 - "Accelerator is not available for mode '{0}'".format(mode)  
284 - 275 + assert isinstance(intervals['accelerator'], int), \
  276 + "Accelerator should be an 'int', " \
  277 + "not '{}'".format(type(intervals['accelerator']).__name__)
  278 + assert intervals['accelerator'] >= 0, \
  279 + "Accelerator should not be less than 0"
285 if mode == 'negotiation': 280 if mode == 'negotiation':
286 return munchify({'data': test_tender_data_limited(tender_parameters)}) 281 return munchify({'data': test_tender_data_limited(tender_parameters)})
287 elif mode == 'negotiation.quick': 282 elif mode == 'negotiation.quick':
Please register or login to post a comment