keywords.robot
4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
*** Setting ***
Library op_robot_tests.tests_files.ApiCommands
Library String
LIbrary Collections
*** Keywords ***
Create api wrapper
${API}= prepare_api ${api_key}
Set Global Variable ${API}
LOG ${API}
Log Variables
Set access key on tender
${tender}= set_access_key ${tender} ${access_token}
Set Global Variable ${tender}
Create tender
${init_tender_data}= prepare_test_tender_data
Log object data ${init_tender_data}
${tender}= Call Method ${API} create_tender ${init_tender_data}
Log object data ${tender}
${access_token}= Get Variable Value ${tender.access.token}
Set Global Variable ${access_token}
${tender_id}= Get Variable Value ${tender.data.id}
Set Global Variable ${tender_id}
Log access_key: ${access_token}
Log tender_id: ${tender_id}
Log Variables
Set Global Variable ${tender}
[return] ${tender}
Change tender title
${new_tender_sufix}= Generate Random String 3 [NUMBERS]
${new_tender_title}= Set Variable 1-QUINTA-KT-${new_tender_sufix}
Log new title: ${new_tender_title}
Log object data ${tender}
${tender.data.title}= Set Variable ${new_tender_title}
${tender.data.title_en}= Set Variable ${new_tender_title}
${tender.data.title_ru}= Set Variable ${new_tender_title}
Log object data ${tender}
${tender}= Call Method ${API} patch_tender ${tender}
Set Global Variable ${tender}
Log object data ${tender}
Set access key on tender
Change tender periods
Log object data ${tender}
${tender}= set_tender_periods ${tender}
Log object data ${tender}
${tender}= Call Method ${API} patch_tender ${tender}
Set Global Variable ${tender}
Log object data ${tender}
Set access key on tender
Upload tender documentation
${file}= upload tender document ${API} ${tender}
patch tender document ${API} ${tender} ${file.data.id}
Create question
${question}= test question data
Log object data ${question}
${question}= Call Method ${API} create_question ${tender} ${question}
Log object data ${question}
[return] ${question}
Write answer on first question
${questions}= Call Method ${API} get_questions ${tender}
Log object data ${questions}
${question}= Set Variable ${questions.data[0]}
Log object data ${question}
${question}= Call Method ${API} get_question ${tender} ${questions.data[0].id}
Log object data ${question}
${question}= set_access_key ${question} ${access_token}
Log object data ${question}
${answer}= test_question_answer_data
Log object data ${answer}
${question.data.answer}= Set Variable ${answer['data']['answer']}
Log object data ${question}
${question}= Call Method ${API} patch_question ${tender} ${question}
Log object data ${question}
[return] ${question}
Review tender
${tender}= Call Method ${API} get_tender ${tender_id}
Set Global Variable ${tender}
Log object data ${tender}
Set access key on tender
Wait to TenderPeriod
Sleep 2 minutes 10 seconds Wait on TenderPeriod status
Wait to start of auction's worker
Sleep 4 minutes
Submit bids
${bids} = Create Dictionary
Log object data ${bids}
:FOR ${index} IN RANGE 2
\ ${bid}= test bid data
\ Log object data ${bid}
\ ${temp_amount}= Evaluate ${bid['data']['value']['amount']} - ${index}
\ Log ${temp_amount}
\ ${bid.data.value.amount}= Get Variable Value ${temp_amount}
\ ${bids_data}= Submit bid with data ${bid}
\ Set To Dictionary ${bids} ${index} ${bids_data}
Set Global Variable ${bids}
Log object data ${bids}
Submit bid with data
[Arguments] ${bid}
${bid_data}= Call Method ${API} create_bid ${tender} ${bid}
Log object data ${bid_data}
[return] ${bid_data}
Get particular urls for bids
${bids_items}= Get Dictionary Items ${bids}
:FOR ${index} ${bid} IN @{bids_items}
\ ${approved_bid}= Call Method ${API} get_bid ${tender} ${bid.data.id} ${bid.access.token}
\ Log object data ${approved_bid}
\ Log ${approved_bid.data.participationUrl}
Wait to end of auction
Sleep 45 minutes Wait to end of auction
Activate award
${awards}= Call Method ${API} get_awards ${tender}
Log object data ${awards}
# :FOR ${award} IN @{awards.data}
# \
# award_id = [i['id'] for i in awards.data if i['status'] == 'pending'][0]
# active_award = munchify({"data": {"status": "active", "id": award_id}})
# award = api.patch_award(tender, active_award)
# write_yaml('award_active.yaml', award)