Commit deb1a7e2a88f0b6cd4bf9ac0c8324c1d59ff45f4

Authored by Leits
Committed by mykhaly
1 parent 9555514f

Use munch in ${USERS.users['${username}'].tender_data}

Rename `Get_From_Object` -> `get_from_object`
Make small changes to generate_test_bid_data
... ... @@ -380,9 +380,8 @@ Resource resource.robot
380 380
381 381
382 382 Можливість змінити пропозицію до ${amount} користувачем ${username}
383   - ${field}= Set Variable If ${number_of_lots} == 0 value.amount lotValues.0.value.amount
  383 + ${field}= Set Variable If ${number_of_lots} == 0 value.amount lotValues[0].value.amount
384 384 ${fixbidto10resp}= Run As ${username} Змінити цінову пропозицію ${TENDER['TENDER_UAID']} ${field} ${amount}
385   - Set To Dictionary ${USERS.users['${username}'].bidresponses} fixbidto10resp=${fixbidto10resp}
386 385
387 386
388 387 Можливість завантажити документ в пропозицію користувачем ${username}
... ...
... ... @@ -82,6 +82,7 @@ Library openprocurement_client_helper.py
82 82 ${tender}= Call Method ${USERS.users['${username}'].client} get_tender ${internalid}
83 83 ${tender}= set_access_key ${tender} ${USERS.users['${username}'].access_token}
84 84 Set To Dictionary ${USERS.users['${username}']} tender_data=${tender}
  85 + ${tender}= munch_dict arg=${tender}
85 86 Log ${tender}
86 87 [return] ${tender}
87 88
... ...
... ... @@ -247,7 +247,7 @@ Get Broker Property By Username
247 247
248 248 Підготувати дані для подання пропозиції
249 249 [Arguments] ${username}
250   - ${bid}= generate_test_bid_data ${USERS.users['${username}'].tender_data}
  250 + ${bid}= generate_test_bid_data ${USERS.users['${username}'].tender_data.data}
251 251 [Return] ${bid}
252 252
253 253
... ... @@ -370,7 +370,7 @@ Get Broker Property By Username
370 370
371 371 Звірити поле тендера
372 372 [Arguments] ${username} ${tender_uaid} ${tender_data} ${field}
373   - ${left}= Get_From_Object ${tender_data.data} ${field}
  373 + ${left}= get_from_object ${tender_data.data} ${field}
374 374 Звірити поле тендера із значенням ${username} ${tender_uaid} ${left} ${field}
375 375
376 376
... ... @@ -391,7 +391,7 @@ Get Broker Property By Username
391 391
392 392 Звірити дату тендера
393 393 [Arguments] ${username} ${tender_uaid} ${tender_data} ${field} ${accuracy}=60 ${absolute_delta}=${False}
394   - ${left}= Get_From_Object ${tender_data.data} ${field}
  394 + ${left}= get_from_object ${tender_data.data} ${field}
395 395 Звірити дату тендера із значенням ${username} ${tender_uaid} ${left} ${field} accuracy=${accuracy} absolute_delta=${absolute_delta}
396 396
397 397
... ... @@ -420,8 +420,8 @@ Get Broker Property By Username
420 420
421 421 Звірити координати доставки тендера
422 422 [Arguments] ${username} ${tender_uaid} ${tender_data} ${field} ${object_id}=${Empty}
423   - ${left_lat}= Get_From_Object ${tender_data.data} ${field}.deliveryLocation.latitude
424   - ${left_lon}= Get_From_Object ${tender_data.data} ${field}.deliveryLocation.longitude
  423 + ${left_lat}= get_from_object ${tender_data.data} ${field}.deliveryLocation.latitude
  424 + ${left_lon}= get_from_object ${tender_data.data} ${field}.deliveryLocation.longitude
425 425 ${right_lat}= Отримати дані із тендера ${username} ${tender_uaid} ${field}.deliveryLocation.latitude ${object_id}
426 426 ${right_lon}= Отримати дані із тендера ${username} ${tender_uaid} ${field}.deliveryLocation.longitude ${object_id}
427 427 Порівняти координати ${left_lat} ${left_lon} ${right_lat} ${right_lon}
... ... @@ -446,7 +446,7 @@ Get Broker Property By Username
446 446
447 447 Звірити поля предметів закупівлі багатопредметного тендера
448 448 [Arguments] ${username} ${tender_data} ${field}
449   - @{items}= Get_From_Object ${tender_data.data} items
  449 + @{items}= get_from_object ${tender_data.data} items
450 450 ${len_of_items}= Get Length ${items}
451 451 :FOR ${index} IN RANGE ${len_of_items}
452 452 \ Звірити поле тендера ${viewer} ${tender_data} items[${index}].${field}
... ... @@ -454,14 +454,14 @@ Get Broker Property By Username
454 454
455 455 Звірити дату предметів закупівлі багатопредметного тендера
456 456 [Arguments] ${username} ${tender_data} ${field} ${accuracy}=60 ${absolute_delta}=${False}
457   - @{items}= Get_From_Object ${tender_data.data} items
  457 + @{items}= get_from_object ${tender_data.data} items
458 458 :FOR ${index} ${_} IN ENUMERATE @{items}
459 459 \ Звірити дату тендера ${viewer} ${tender_data} items[${index}].${field} accuracy=${accuracy} absolute_delta=${absolute_delta}
460 460
461 461
462 462 Звірити координати доставки предметів закупівлі багатопредметного тендера
463 463 [Arguments] ${username} ${tender_data}
464   - @{items}= Get_From_Object ${tender_data.data} items
  464 + @{items}= get_from_object ${tender_data.data} items
465 465 :FOR ${index} ${_} IN ENUMERATE @{items}
466 466 \ Звірити координати тендера ${viewer} ${tender_data} items[${index}]
467 467
... ... @@ -471,7 +471,7 @@ Get Broker Property By Username
471 471 ${field}= Run Keyword If '${object_id}' Отримати шлях до поля об’єкта ${username} ${field_name} ${object_id}
472 472 ... ELSE Set Variable ${field_name}
473 473 ${status} ${field_value}= Run keyword and ignore error
474   - ... Get from object
  474 + ... get_from_object
475 475 ... ${USERS.users['${username}'].tender_data.data}
476 476 ... ${field}
477 477 # If field in cache, return its value
... ... @@ -481,6 +481,9 @@ Get Broker Property By Username
481 481 ... ELSE Run As ${username} Отримати інформацію із тендера ${tender_uaid} ${field}
482 482 # And caching its value before return
483 483 Set_To_Object ${USERS.users['${username}'].tender_data.data} ${field} ${field_value}
  484 + ${data}= munch_dict arg=${USERS.users['${username}'].tender_data.data}
  485 + Set To Dictionary ${USERS.users['${username}'].tender_data} data=${data}
  486 + Log ${USERS.users['${username}'].tender_data.data}
484 487 [return] ${field_value}
485 488
486 489
... ...
... ... @@ -442,21 +442,21 @@ def get_document_index_by_id(data, document_id):
442 442
443 443 def generate_test_bid_data(tender_data):
444 444 bid = test_bid_data()
445   - if 'aboveThreshold' in tender_data['data']['procurementMethodType']:
  445 + if 'aboveThreshold' in tender_data['procurementMethodType']:
446 446 bid.data.selfEligible = True
447 447 bid.data.selfQualified = True
448   - if 'lots' in tender_data['data']:
  448 + if 'lots' in tender_data:
449 449 bid.data.lotValues = []
450   - for lot in tender_data['data']['lots']:
  450 + for lot in tender_data['lots']:
451 451 value = test_bid_value(lot['value']['amount'])
452   - value['relatedLot'] = lot['id']
  452 + value['relatedLot'] = lot.get('id', '')
453 453 bid.data.lotValues.append(value)
454 454 else:
455   - bid.data.update(test_bid_value(tender_data['data']['value']['amount']))
456   - if 'features' in tender_data['data']:
  455 + bid.data.update(test_bid_value(tender_data['value']['amount']))
  456 + if 'features' in tender_data:
457 457 bid.data.parameters = []
458   - for feature in tender_data['data']['features']:
459   - parameter = {"value": fake.random_element(elements=(0.15, 0.1, 0.05, 0)), "code": feature['code']}
  458 + for feature in tender_data['features']:
  459 + parameter = {"value": fake.random_element(elements=(0.15, 0.1, 0.05, 0)), "code": feature.get('code', '')}
460 460 bid.data.parameters.append(parameter)
461 461 return bid
462 462
... ...
Please register or login to post a comment