Commit 2e151f460d92dcf26932183080efd7ec4a284a5f

Authored by mykhaly
1 parent ac8c3afb

Add "complaints representation" to keywords.robot

... ... @@ -513,6 +513,37 @@ Get Broker Property By Username
513 513 [return] ${objects_ids}
514 514
515 515
  516 +Звірити поле скарги із значенням
  517 + [Arguments] ${username} ${given_value} ${field_name} ${complaintID}
  518 + ${received_value}= Отримати дані із скарги на умови ${username} ${complaintID} ${field_name} ${given_value}
  519 + Порівняти об'єкти ${given_value} ${received_value}
  520 +
  521 +
  522 +Отримати дані із скарги на умови
  523 + [Arguments] ${username} ${complaintID} ${field_name} ${given_value}
  524 + ${complaints}= Get Variable Value ${USERS.users['${username}'].tender_data.data.complaints}
  525 + ${complaint_index}= get_complaint_index_by_complaintID ${complaints} ${complaintID}
  526 + ${status}= Call method ${field_name} startswith document.
  527 + ${fetched_field_name}= Run keyword if ${status} == ${True} Fetch From Right ${field_name} .
  528 + ${field_name}= Set variable if ${status} == ${True} ${fetched_field_name} ${field_name}
  529 + Run keyword And Return if ${status} == ${True} Отримати поле документа
  530 + ... ${username}
  531 + ... ${complaints[${complaint_index}].documents}
  532 + ... ${given_value}
  533 + ... ${field_name}
  534 + ${field_value}= Get Variable Value ${USERS.users['${username}'].tender_data.data.complaints[${complaint_index}]['${field_name}']}
  535 + Log ${field_value}
  536 + [Return] ${field_value}
  537 +
  538 +
  539 +Отримати поле документа
  540 + [Arguments] ${username} ${documents} ${document_id} ${field_name}
  541 + ${document_index}= get_document_index_by_id ${documents} ${document_id}
  542 + ${field_value}= Get Variable Value ${documents[${document_index}]['${field_name}']}
  543 + Log ${field_value}
  544 + [Return] ${field_value}
  545 +
  546 +
516 547 Викликати для учасника
517 548 [Arguments] ${username} ${command} @{arguments}
518 549 Run keyword unless '${WARN_RUN_AS}' == '${True}'
... ...
... ... @@ -419,6 +419,21 @@ def get_object_index_by_id(data, object_id):
419 419 return index
420 420
421 421
  422 +def get_complaint_index_by_complaintID(data, complaintID):
  423 + for index, element in enumerate(data):
  424 + if element['complaintID'] == complaintID:
  425 + return index
  426 + raise IndexError
  427 +
  428 +
  429 +def get_document_index_by_id(data, document_id):
  430 + for index, element in enumerate(data):
  431 + if element['title'] == document_id:
  432 + return index
  433 + raise IndexError
  434 +
  435 +
  436 +
422 437 # GUI Frontends common
423 438 def add_data_for_gui_frontends(tender_data):
424 439 now = get_now()
... ...
Please register or login to post a comment