Commit 5623171f3767aeecdd960d36b68334c72f799f2c
Committed by
GitHub
Merge pull request #498 from lesiavl/master
Update tests due to requirements, add new test cases
Showing
5 changed files
with
125 additions
and
17 deletions
| ... | ... | @@ -61,9 +61,19 @@ Library openprocurement_client_helper.py |
| 61 | 61 | Отримати посилання на аукціон для глядача |
| 62 | 62 | [Arguments] ${username} ${tender_uaid} ${lot_id}=${Empty} |
| 63 | 63 | ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid} |
| 64 | - ${auctionUrl}= Run Keyword IF '${lot_id}' Set Variable ${tender.data.lots[${lot_index}].auctionUrl} | |
| 65 | - ... ELSE Set Variable ${tender.data.auctionUrl} | |
| 66 | - [return] ${auctionUrl} | |
| 64 | + ${object_with_url}= get_object_by_id ${tender.data} ${lot_id} lots id | |
| 65 | + Log ${object_with_url} | |
| 66 | + ${auctionUrl}= Get Variable Value ${object_with_url['auctionUrl']} | |
| 67 | + [Return] ${auctionUrl} | |
| 68 | + | |
| 69 | + | |
| 70 | +Отримати посилання на аукціон для учасника | |
| 71 | + [Arguments] ${username} ${tender_uaid} ${relatedLot}=${Empty} | |
| 72 | + ${bid}= openprocurement_client.Отримати пропозицію ${username} ${tender_uaid} | |
| 73 | + ${object_with_url}= get_object_by_id ${bid.data} ${relatedLot} lotValues relatedLot | |
| 74 | + Log ${object_with_url} | |
| 75 | + ${participationUrl}= Get Variable Value ${object_with_url['participationUrl']} | |
| 76 | + [Return] ${participationUrl} | |
| 67 | 77 | |
| 68 | 78 | ############################################################################## |
| 69 | 79 | # Tender operations |
| ... | ... | @@ -792,13 +802,6 @@ Library openprocurement_client_helper.py |
| 792 | 802 | [return] ${bid.data.${field}} |
| 793 | 803 | |
| 794 | 804 | |
| 795 | -Отримати посилання на аукціон для учасника | |
| 796 | - [Arguments] ${username} ${tender_uaid} ${lot_id}=${Empty} | |
| 797 | - ${bid}= openprocurement_client.Отримати пропозицію ${username} ${tender_uaid} | |
| 798 | - ${participationUrl}= Run Keyword IF '${lot_id}' Set Variable ${bid.data.lotValues[${lot_index}].participationUrl} | |
| 799 | - ... ELSE Set Variable ${bid.data.participationUrl} | |
| 800 | - [return] ${participationUrl} | |
| 801 | - | |
| 802 | 805 | ############################################################################## |
| 803 | 806 | # Qualification operations |
| 804 | 807 | ############################################################################## | ... | ... |
| ... | ... | @@ -101,7 +101,7 @@ def test_tender_data(params, |
| 101 | 101 | inc_dt += timedelta(minutes=params['intervals'][period_name][i]) |
| 102 | 102 | period_dict[period_name + "Period"][j + "Date"] = inc_dt.isoformat() |
| 103 | 103 | data.update(period_dict) |
| 104 | - cpv_group = fake.cpv()[:3] | |
| 104 | + cpv_group = fake.cpv()[:4] | |
| 105 | 105 | if params.get('number_of_lots'): |
| 106 | 106 | data['lots'] = [] |
| 107 | 107 | for lot_number in range(params['number_of_lots']): | ... | ... |
| ... | ... | @@ -599,6 +599,37 @@ Require Failure |
| 599 | 599 | [return] ${value} |
| 600 | 600 | |
| 601 | 601 | |
| 602 | + | |
| 603 | +Можливість отримати посилання на аукціон для глядача | |
| 604 | + ${timeout_on_wait}= Get Broker Property By Username ${viewer} timeout_on_wait | |
| 605 | + ${timeout_on_wait}= Set Variable If | |
| 606 | + ... ${timeout_on_wait} < ${120} | |
| 607 | + ... ${120} | |
| 608 | + ... ${timeout_on_wait} | |
| 609 | + ${url}= Wait Until Keyword Succeeds | |
| 610 | + ... ${timeout_on_wait} | |
| 611 | + ... 15 s | |
| 612 | + ... Run As ${viewer} Отримати посилання на аукціон для глядача ${TENDER['TENDER_UAID']} | |
| 613 | + Should Be True '${url}' | |
| 614 | + Should Match Regexp ${url} ^https?:\/\/auction(?:-sandbox)?\.openprocurement\.org\/tenders\/([0-9A-Fa-f]{32}) | |
| 615 | + Log URL аукціону для глядача: ${url} | |
| 616 | + | |
| 617 | + | |
| 618 | +Можливість отримати посилання на аукціон для учасника ${username} | |
| 619 | + ${timeout_on_wait}= Get Broker Property By Username ${username} timeout_on_wait | |
| 620 | + ${timeout_on_wait}= Set Variable If | |
| 621 | + ... ${timeout_on_wait} < ${120} | |
| 622 | + ... ${120} | |
| 623 | + ... ${timeout_on_wait} | |
| 624 | + ${url}= Wait Until Keyword Succeeds | |
| 625 | + ... ${timeout_on_wait} | |
| 626 | + ... 15 s | |
| 627 | + ... Run As ${username} Отримати посилання на аукціон для учасника ${TENDER['TENDER_UAID']} | |
| 628 | + Should Be True '${url}' | |
| 629 | + Should Match Regexp ${url} ^https?:\/\/auction(?:-sandbox)?\.openprocurement\.org\/tenders\/([0-9A-Fa-f]{32}) | |
| 630 | + Log URL аукціону для учасника: ${url} | |
| 631 | + | |
| 632 | + | |
| 602 | 633 | Дочекатись дати |
| 603 | 634 | [Arguments] ${date} |
| 604 | 635 | ${sleep}= wait_to_date ${date} | ... | ... |
| ... | ... | @@ -1847,6 +1847,37 @@ ${ITEM_MEAT} ${True} |
| 1847 | 1847 | ... compare_stages |
| 1848 | 1848 | Звірити відображення поля procuringEntity.name тендера із ${USERS.users['${tender_owner}'].second_stage_data.data.procuringEntity.name} для користувача ${viewer} |
| 1849 | 1849 | |
| 1850 | +################################################################### | |
| 1851 | +# Відображення посилання на аукціон | |
| 1852 | +################################################################### | |
| 1853 | + | |
| 1854 | +Можливість вичитати посилання на аукціон для глядача | |
| 1855 | + [Tags] ${USERS.users['${viewer}'].broker}: Процес аукціону | |
| 1856 | + ... viewer | |
| 1857 | + ... ${USERS.users['${viewer}'].broker} | |
| 1858 | + ... auction_url | |
| 1859 | + [Setup] Дочекатись дати початку періоду аукціону ${viewer} ${TENDER['TENDER_UAID']} | |
| 1860 | + Можливість отримати посилання на аукціон для глядача | |
| 1861 | + | |
| 1862 | + | |
| 1863 | +Можливість вичитати посилання на аукціон для першого учасника | |
| 1864 | + [Tags] ${USERS.users['${provider}'].broker}: Процес аукціону | |
| 1865 | + ... provider | |
| 1866 | + ... ${USERS.users['${provider}'].broker} | |
| 1867 | + ... auction_url | |
| 1868 | + [Setup] Дочекатись синхронізації з майданчиком ${provider} | |
| 1869 | + Можливість отримати посилання на аукціон для учасника ${provider} | |
| 1870 | + | |
| 1871 | + | |
| 1872 | +Можливість вичитати посилання на аукціон для другого учасника | |
| 1873 | + [Tags] ${USERS.users['${provider1}'].broker}: Процес аукціону | |
| 1874 | + ... provider1 | |
| 1875 | + ... ${USERS.users['${provider1}'].broker} | |
| 1876 | + ... auction_url | |
| 1877 | + [Setup] Дочекатись синхронізації з майданчиком ${provider1} | |
| 1878 | + Можливість отримати посилання на аукціон для учасника ${provider1} | |
| 1879 | + | |
| 1880 | + | |
| 1850 | 1881 | ############################################################################################## |
| 1851 | 1882 | # Відображення основних даних лоту для другого етапу |
| 1852 | 1883 | ############################################################################################## |
| ... | ... | @@ -1982,4 +2013,20 @@ ${ITEM_MEAT} ${True} |
| 1982 | 2013 | ... pre-qualification_approve_qualifications_second_stage |
| 1983 | 2014 | [Setup] Дочекатись синхронізації з майданчиком ${tender_owner} |
| 1984 | 2015 | [Teardown] Оновити LAST_MODIFICATION_DATE |
| 1985 | - Можливість затвердити остаточне рішення кваліфікації | |
| \ No newline at end of file | ||
| 2016 | + Можливість затвердити остаточне рішення кваліфікації | |
| 2017 | + | |
| 2018 | +################################################################################ | |
| 2019 | + | |
| 2020 | +Перевірка завантаження документів до тендера через Document Service | |
| 2021 | + [Tags] ${USERS.users['${viewer}'].broker}: Document Service | |
| 2022 | + ... viewer | |
| 2023 | + ... ${USERS.users['${tender_owner}'].broker} | |
| 2024 | + ... document_service | |
| 2025 | + [Setup] Дочекатись синхронізації з майданчиком ${viewer} | |
| 2026 | + ${documents}= Get From Dictionary ${USERS.users['${tender_owner}'].tender_data.data} documents | |
| 2027 | + ${doc_number}= Get Length ${documents} | |
| 2028 | + Log ${documents} | |
| 2029 | + :FOR ${doc_index} IN RANGE ${doc_number} | |
| 2030 | + \ ${document_url}= Get From Dictionary ${documents[${doc_index}]} url | |
| 2031 | + \ Should Match Regexp ${document_url} ^https?:\/\/public.docs(?:-sandbox)?\.openprocurement\.org\/get\/([0-9A-Fa-f]{32}) msg=Not a Document Service Upload | |
| 2032 | + # Url pattern may differ, because document service is being developed | ... | ... |
| ... | ... | @@ -443,29 +443,56 @@ def get_object_type_by_id(object_id): |
| 443 | 443 | return prefixes.get(object_id[0]) |
| 444 | 444 | |
| 445 | 445 | |
| 446 | -def get_object_index_by_id(data, object_id): | |
| 446 | +def get_complaint_index_by_complaintID(data, complaintID): | |
| 447 | 447 | if not data: |
| 448 | 448 | return 0 |
| 449 | 449 | for index, element in enumerate(data): |
| 450 | - element_id = get_id_from_object(element) | |
| 451 | - if element_id == object_id: | |
| 450 | + if element['complaintID'] == complaintID: | |
| 452 | 451 | break |
| 453 | 452 | else: |
| 454 | 453 | index += 1 |
| 455 | 454 | return index |
| 456 | 455 | |
| 457 | 456 | |
| 458 | -def get_complaint_index_by_complaintID(data, complaintID): | |
| 457 | +def get_object_index_by_id(data, object_id): | |
| 459 | 458 | if not data: |
| 460 | 459 | return 0 |
| 461 | 460 | for index, element in enumerate(data): |
| 462 | - if element['complaintID'] == complaintID: | |
| 461 | + element_id = get_id_from_object(element) | |
| 462 | + if element_id == object_id: | |
| 463 | 463 | break |
| 464 | 464 | else: |
| 465 | 465 | index += 1 |
| 466 | 466 | return index |
| 467 | 467 | |
| 468 | 468 | |
| 469 | +def get_object_by_id(data, given_object_id, slice_element, object_id): | |
| 470 | + """ | |
| 471 | + data: object to slice | |
| 472 | + given_object_id: with what id we should compare | |
| 473 | + slice_element: what path should be extracted (e.g. from { key: val } extract key ) | |
| 474 | + object_id: what property is id (e.g. from { id: 1, name: 2 } extract id) | |
| 475 | + """ | |
| 476 | + | |
| 477 | + # Slice the given object, e.g. slice bid object to lotValues object | |
| 478 | + try: | |
| 479 | + sliced_object = data[slice_element] | |
| 480 | + except KeyError: | |
| 481 | + return data | |
| 482 | + | |
| 483 | + # If there is one sliced object, get the 1st element | |
| 484 | + if len(sliced_object) == 1: | |
| 485 | + return sliced_object[0] | |
| 486 | + | |
| 487 | + # Compare given object id and id from sliced object | |
| 488 | + for index, element in enumerate(sliced_object): | |
| 489 | + element_id = element[object_id] | |
| 490 | + if element_id == given_object_id: | |
| 491 | + return element | |
| 492 | + | |
| 493 | + return sliced_object[0] | |
| 494 | + | |
| 495 | + | |
| 469 | 496 | def generate_test_bid_data(tender_data): |
| 470 | 497 | bid = test_bid_data() |
| 471 | 498 | if tender_data.get('procurementMethodType', '')[:-2] in ('aboveThreshold', 'competitiveDialogue'): | ... | ... |
Please
register
or
login
to post a comment