Showing
5 changed files
with
39 additions
and
23 deletions
... | ... | @@ -80,15 +80,21 @@ Resource resource.robot |
80 | 80 | |
81 | 81 | |
82 | 82 | Можливість прочитати тендери |
83 | - :FOR ${username} IN ${tender_owner} ${viewer} | |
83 | + :FOR ${username} IN ${viewer} | |
84 | 84 | \ Можливість прочитати тендери для користувача ${username} |
85 | 85 | |
86 | 86 | |
87 | 87 | Можливість прочитати тендери для користувача ${username} |
88 | 88 | ${tenders_feed}= Отримати список тендерів ${username} |
89 | - :FOR ${tenders_feed_item} IN @{tenders_feed} | |
89 | + ${tenders_len}= Get Length ${tenders_feed} | |
90 | + ${items_number}= Evaluate min(${FEED_ITEMS_NUMBER}, ${tenders_len}) | |
91 | + Log To Console ${items_number}/${tenders_len} | |
92 | + :FOR ${index} IN RANGE 0 ${items_number} | |
93 | + \ ${rand_index}= Evaluate random.randint(0, ${tenders_len}) modules=random | |
94 | + \ ${tenders_feed_item}= Get From List ${tenders_feed} ${rand_index} | |
90 | 95 | \ ${internalid}= Get From Dictionary ${tenders_feed_item} id |
91 | - \ Log To Console Читання тендеру з id ${internalid} | |
96 | + \ ${date_modified}= Get From Dictionary ${tenders_feed_item} dateModified | |
97 | + \ Log To Console - Читання тендеру ${index} з id ${internalid} та датою модифікації ${date_modified} | |
92 | 98 | \ Отримати тендер по внутрішньому ідентифікатору ${username} ${internalid} |
93 | 99 | |
94 | 100 | |
... | ... | @@ -98,15 +104,21 @@ Resource resource.robot |
98 | 104 | |
99 | 105 | |
100 | 106 | Можливість прочитати плани |
101 | - :FOR ${username} IN ${tender_owner} ${viewer} | |
107 | + :FOR ${username} IN ${viewer} | |
102 | 108 | \ Можливість прочитати плани для користувача ${username} |
103 | 109 | |
104 | 110 | |
105 | 111 | Можливість прочитати плани для користувача ${username} |
106 | 112 | ${plans_feed}= Отримати список планів ${username} |
107 | - :FOR ${plans_feed_item} IN @{plans_feed} | |
113 | + ${plans_len}= Get Length ${plans_feed} | |
114 | + ${items_number}= Evaluate min(${FEED_ITEMS_NUMBER}, ${plans_len}) | |
115 | + Log To Console ${items_number}/${plans_len} | |
116 | + :FOR ${index} IN RANGE 0 ${items_number} | |
117 | + \ ${rand_index}= Evaluate random.randint(0, ${plans_len}) modules=random | |
118 | + \ ${plans_feed_item}= Get From List ${plans_feed} ${rand_index} | |
108 | 119 | \ ${internalid}= Get From Dictionary ${plans_feed_item} id |
109 | - \ Log To Console Читання плану з id ${internalid} | |
120 | + \ ${date_modified}= Get From Dictionary ${plans_feed_item} dateModified | |
121 | + \ Log To Console - Читання плану ${index} з id ${internalid} та датою модифікації ${date_modified} | |
110 | 122 | \ Отримати план по внутрішньому ідентифікатору ${username} ${internalid} |
111 | 123 | |
112 | 124 | ... | ... |
... | ... | @@ -227,7 +227,8 @@ Library openprocurement_client.utils |
227 | 227 | |
228 | 228 | Отримати список тендерів |
229 | 229 | [Arguments] ${username} |
230 | - ${tenders_feed}= Run Keyword get_tenders_feed ${USERS.users['${username}'].client} | |
230 | + ${tenders_feed_generator}= Run Keyword get_tenders_feed ${USERS.users['${username}'].client} | |
231 | + @{tenders_feed}= Set Variable @{tenders_feed_generator} | |
231 | 232 | [return] ${tenders_feed} |
232 | 233 | |
233 | 234 | |
... | ... | @@ -367,7 +368,8 @@ Library openprocurement_client.utils |
367 | 368 | |
368 | 369 | Отримати список планів |
369 | 370 | [Arguments] ${username} |
370 | - ${plans_feed}= Run Keyword get_plans_feed ${USERS.users['${username}'].client} | |
371 | + ${plans_feed_generator}= Run Keyword get_plans_feed ${USERS.users['${username}'].client} | |
372 | + @{plans_feed}= Set Variable @{plans_feed_generator} | |
371 | 373 | [return] ${plans_feed} |
372 | 374 | |
373 | 375 | ... | ... |
... | ... | @@ -119,20 +119,22 @@ def get_document_by_id(data, doc_id): |
119 | 119 | raise Exception('Document with id {} not found'.format(doc_id)) |
120 | 120 | |
121 | 121 | |
122 | -def get_tenders_feed(client): | |
122 | +def get_tenders_feed(client, interval=0.5): | |
123 | 123 | tender_list = True |
124 | 124 | while tender_list: |
125 | 125 | tender_list = client.get_tenders() |
126 | 126 | for tender in tender_list: |
127 | 127 | yield tender |
128 | + sleep(interval) | |
128 | 129 | |
129 | 130 | |
130 | -def get_plans_feed(client): | |
131 | - tender_list = True | |
132 | - while tender_list: | |
133 | - tender_list = client.get_plans() | |
134 | - for tender in tender_list: | |
135 | - yield tender | |
131 | +def get_plans_feed(client, interval=0.5): | |
132 | + plans_list = True | |
133 | + while plans_list: | |
134 | + plans_list = client.get_plans() | |
135 | + for plan in plans_list: | |
136 | + yield plan | |
137 | + sleep(interval) | |
136 | 138 | |
137 | 139 | |
138 | 140 | def get_tenders_by_funder_id(client, | ... | ... |
... | ... | @@ -6,15 +6,15 @@ Suite Teardown Test Suite Teardown |
6 | 6 | |
7 | 7 | |
8 | 8 | *** Variables *** |
9 | -${RESOURCE} plans | |
10 | -@{USED_ROLES} tender_owner viewer | |
9 | +${RESOURCE} plans | |
10 | +@{USED_ROLES} viewer | |
11 | +${FEED_ITEMS_NUMBER} 10 | |
11 | 12 | |
12 | 13 | *** Test Cases *** |
13 | 14 | Можливість переглянути плани |
14 | 15 | [Tags] ${USERS.users['${viewer}'].broker}: Читання планів |
15 | - ... viewer tender_owner | |
16 | + ... viewer | |
16 | 17 | ... ${USERS.users['${viewer}'].broker} |
17 | - ... ${USERS.users['${tender_owner}'].broker} | |
18 | 18 | ... plan_feed |
19 | 19 | ... plan_view |
20 | 20 | ... critical | ... | ... |
... | ... | @@ -6,15 +6,15 @@ Suite Teardown Test Suite Teardown |
6 | 6 | |
7 | 7 | |
8 | 8 | *** Variables *** |
9 | -${RESOURCE} tenders | |
10 | -@{USED_ROLES} tender_owner viewer | |
9 | +${RESOURCE} tenders | |
10 | +@{USED_ROLES} viewer | |
11 | +${FEED_ITEMS_NUMBER} 10 | |
11 | 12 | |
12 | 13 | *** Test Cases *** |
13 | 14 | Можливість переглянути тендери |
14 | 15 | [Tags] ${USERS.users['${viewer}'].broker}: Читання тендерів |
15 | - ... viewer tender_owner | |
16 | + ... viewer | |
16 | 17 | ... ${USERS.users['${viewer}'].broker} |
17 | - ... ${USERS.users['${tender_owner}'].broker} | |
18 | 18 | ... tender_feed |
19 | 19 | ... tender_view |
20 | 20 | ... critical | ... | ... |
Please
register
or
login
to post a comment