Commit 08ed4bc5552670cf4190728409bb2320dc58cc30
1 parent
6db6eb04
Remake tender and lot documents addition
Add ${doc_id} variable and get_id_from_doc_name function. Use updated `create_fake_doc` function. Use better names for variables.
Showing
2 changed files
with
17 additions
and
7 deletions
@@ -40,10 +40,12 @@ Resource resource.robot | @@ -40,10 +40,12 @@ Resource resource.robot | ||
40 | 40 | ||
41 | 41 | ||
42 | Можливість додати документацію до тендера | 42 | Можливість додати документацію до тендера |
43 | - ${filepath}= create_fake_doc | ||
44 | - Run As ${tender_owner} Завантажити документ ${filepath} ${TENDER['TENDER_UAID']} | ||
45 | - ${documents}= Create Dictionary filepath=${filepath} | ||
46 | - Set To Dictionary ${USERS.users['${tender_owner}']} documents=${documents} | 43 | + ${file_path} ${file_name} ${file_content}= create_fake_doc |
44 | + Run As ${tender_owner} Завантажити документ ${file_path} ${TENDER['TENDER_UAID']} | ||
45 | + ${doc_id}= get_id_from_doc_name ${file_name} | ||
46 | + ${tender_document}= Create Dictionary doc_name=${file_name} doc_id=${doc_id} doc_content=${file_content} | ||
47 | + Set To Dictionary ${USERS.users['${tender_owner}']} tender_document=${tender_document} | ||
48 | + Remove File ${file_path} | ||
47 | 49 | ||
48 | 50 | ||
49 | Можливість додати предмет закупівлі в тендер | 51 | Можливість додати предмет закупівлі в тендер |
@@ -153,13 +155,17 @@ Resource resource.robot | @@ -153,13 +155,17 @@ Resource resource.robot | ||
153 | 155 | ||
154 | Можливість додати документацію до ${lot_index} лоту | 156 | Можливість додати документацію до ${lot_index} лоту |
155 | ${lot_id}= get_id_from_object ${USERS.users['${tender_owner}'].tender_data.data.lots[${lot_index}]} | 157 | ${lot_id}= get_id_from_object ${USERS.users['${tender_owner}'].tender_data.data.lots[${lot_index}]} |
156 | - ${filepath}= create_fake_doc | ||
157 | - Run As ${tender_owner} Завантажити документ в лот ${filepath} ${TENDER['TENDER_UAID']} ${lot_id} | 158 | + ${file_path} ${file_name} ${file_content}= create_fake_doc |
159 | + Run As ${tender_owner} Завантажити документ в лот ${file_path} ${TENDER['TENDER_UAID']} ${lot_id} | ||
160 | + ${doc_id}= get_id_from_doc_name ${file_name} | ||
161 | + ${data}= Create Dictionary doc_name=${file_name} doc_id=${doc_id} doc_content=${file_content} | ||
158 | ${empty_list}= Create List | 162 | ${empty_list}= Create List |
159 | ${lots_documents}= Get variable value ${USERS.users['${tender_owner}'].lots_documents} ${empty_list} | 163 | ${lots_documents}= Get variable value ${USERS.users['${tender_owner}'].lots_documents} ${empty_list} |
160 | - Append to list ${lots_documents} ${filepath} | 164 | + Append to list ${lots_documents} ${data} |
161 | Set to dictionary ${USERS.users['${tender_owner}']} lots_documents=${lots_documents} | 165 | Set to dictionary ${USERS.users['${tender_owner}']} lots_documents=${lots_documents} |
162 | Log ${USERS.users['${tender_owner}'].lots_documents} | 166 | Log ${USERS.users['${tender_owner}'].lots_documents} |
167 | + Remove File ${file_path} | ||
168 | + | ||
163 | 169 | ||
164 | Можливість додати документацію до всіх лотів | 170 | Можливість додати документацію до всіх лотів |
165 | ${number_of_lots}= Get Length ${USERS.users['${tender_owner}'].initial_data.data.lots} | 171 | ${number_of_lots}= Get Length ${USERS.users['${tender_owner}'].initial_data.data.lots} |
@@ -413,6 +413,10 @@ def get_id_from_object(obj): | @@ -413,6 +413,10 @@ def get_id_from_object(obj): | ||
413 | return obj_id.group(1) | 413 | return obj_id.group(1) |
414 | 414 | ||
415 | 415 | ||
416 | +def get_id_from_doc_name(name): | ||
417 | + return re.match(r'd\-[0-9a-fA-F]{8}', name).group(0) | ||
418 | + | ||
419 | + | ||
416 | def get_object_type_by_id(object_id): | 420 | def get_object_type_by_id(object_id): |
417 | prefixes = {'q': 'questions', 'f': 'features', 'i': 'items', 'l': 'lots'} | 421 | prefixes = {'q': 'questions', 'f': 'features', 'i': 'items', 'l': 'lots'} |
418 | return prefixes.get(object_id[0]) | 422 | return prefixes.get(object_id[0]) |
Please
register
or
login
to post a comment