...
|
...
|
@@ -4,11 +4,14 @@ from faker import Factory |
4
|
4
|
from munch import munchify
|
5
|
5
|
from tempfile import NamedTemporaryFile
|
6
|
6
|
from .local_time import get_now
|
|
7
|
+from .op_faker import OP_Provider
|
7
|
8
|
import random
|
8
|
9
|
|
|
10
|
+
|
9
|
11
|
fake = Factory.create('uk_UA')
|
10
|
12
|
fake_ru = Factory.create('ru')
|
11
|
13
|
fake_en = Factory.create()
|
|
14
|
+fake.add_provider(OP_Provider)
|
12
|
15
|
|
13
|
16
|
|
14
|
17
|
def create_fake_sentence():
|
...
|
...
|
@@ -16,7 +19,21 @@ def create_fake_sentence(): |
16
|
19
|
|
17
|
20
|
|
18
|
21
|
def field_with_id(prefix, sentence):
|
19
|
|
- return "{}-{}: {}".format(prefix, fake.uuid4()[:8], sentence)
|
|
22
|
+ return u"{}-{}: {}".format(prefix, fake.uuid4()[:8], sentence)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+def translate_country_en(country):
|
|
26
|
+ if country == u"Україна":
|
|
27
|
+ return "Ukraine"
|
|
28
|
+ else:
|
|
29
|
+ raise Exception(u"Cannot translate country to english: {}".format(country))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+def translate_country_ru(country):
|
|
33
|
+ if country == u"Україна":
|
|
34
|
+ return u"Украина"
|
|
35
|
+ else:
|
|
36
|
+ raise Exception(u"Cannot translate country to russian: {}".format(country))
|
20
|
37
|
|
21
|
38
|
|
22
|
39
|
def create_fake_doc():
|
...
|
...
|
@@ -30,38 +47,17 @@ def create_fake_doc(): |
30
|
47
|
|
31
|
48
|
def test_tender_data(intervals, periods=("enquiry", "tender")):
|
32
|
49
|
now = get_now()
|
33
|
|
- value_amount = 50000.99
|
34
|
|
- t_data = {
|
35
|
|
- "title": u"[ТЕСТУВАННЯ] " + fake.catch_phrase(),
|
|
50
|
+ value_amount = round(random.uniform(3000, 250000000000), 2) #max value equals to budget of Ukraine in hryvnias
|
|
51
|
+ data = {
|
36
|
52
|
"mode": "test",
|
37
|
53
|
"submissionMethodDetails": "quick",
|
38
|
|
- "description": u"Тестовий тендер",
|
39
|
|
- "description_ru": u"Тестовый тендер",
|
40
|
|
- "description_en": "Test tender",
|
41
|
|
- "procuringEntity": {
|
42
|
|
- "name": fake.company(),
|
43
|
|
- "name_ru": fake_ru.company(),
|
44
|
|
- "name_en": fake_en.company(),
|
45
|
|
- "identifier": {
|
46
|
|
- "scheme": u"UA-EDR",
|
47
|
|
- "id": u"{:08d}".format(fake.pyint()),
|
48
|
|
- "uri": fake.image_url(width=None, height=None)
|
49
|
|
- },
|
50
|
|
- "address": {
|
51
|
|
- "countryName": u"Україна",
|
52
|
|
- "countryName_ru": u"Украина",
|
53
|
|
- "countryName_en": "Ukraine",
|
54
|
|
- "postalCode": fake.postalcode(),
|
55
|
|
- "region": u"м. Київ",
|
56
|
|
- "locality": u"м. Київ",
|
57
|
|
- "streetAddress": fake.street_address()
|
58
|
|
- },
|
59
|
|
- "contactPoint": {
|
60
|
|
- "name": fake.name(),
|
61
|
|
- "telephone": fake.phone_number()
|
62
|
|
- },
|
63
|
|
- "kind": "other"
|
64
|
|
- },
|
|
54
|
+ "description": fake.description(),
|
|
55
|
+ "description_en": fake_en.sentence(nb_words=10, variable_nb_words=True),
|
|
56
|
+ "description_ru": fake_ru.sentence(nb_words=10, variable_nb_words=True),
|
|
57
|
+ "title": fake.title(),
|
|
58
|
+ "title_en": fake_en.catch_phrase(),
|
|
59
|
+ "title_ru": fake_ru.catch_phrase(),
|
|
60
|
+ "procuringEntity": fake.procuringEntity(),
|
65
|
61
|
"value": {
|
66
|
62
|
"amount": value_amount,
|
67
|
63
|
"currency": u"UAH",
|
...
|
...
|
@@ -73,8 +69,13 @@ def test_tender_data(intervals, periods=("enquiry", "tender")): |
73
|
69
|
},
|
74
|
70
|
"items": []
|
75
|
71
|
}
|
|
72
|
+ data["procuringEntity"]["kind"] = "other"
|
76
|
73
|
new_item = test_item_data()
|
77
|
|
- t_data['items'].append(new_item)
|
|
74
|
+ data["items"].append(new_item)
|
|
75
|
+ if data.get("mode") == "test":
|
|
76
|
+ data["title"] = u"[ТЕСТУВАННЯ] {}".format(data["title"])
|
|
77
|
+ data["title_en"] = u"[TESTING] {}".format(data["title_en"])
|
|
78
|
+ data["title_ru"] = u"[ТЕСТИРОВАНИЕ] {}".format(data["title_ru"])
|
78
|
79
|
period_dict = {}
|
79
|
80
|
inc_dt = now
|
80
|
81
|
for period_name in periods:
|
...
|
...
|
@@ -82,90 +83,18 @@ def test_tender_data(intervals, periods=("enquiry", "tender")): |
82
|
83
|
for i, j in zip(range(2), ("start", "end")):
|
83
|
84
|
inc_dt += timedelta(minutes=intervals[period_name][i])
|
84
|
85
|
period_dict[period_name + "Period"][j + "Date"] = inc_dt.isoformat()
|
85
|
|
- t_data.update(period_dict)
|
86
|
|
- return t_data
|
|
86
|
+ data.update(period_dict)
|
|
87
|
+ return munchify(data)
|
87
|
88
|
|
88
|
89
|
|
89
|
90
|
def test_tender_data_limited(intervals, procurement_method_type):
|
90
|
|
- now = get_now()
|
91
|
|
- data = {
|
92
|
|
- "items":
|
93
|
|
- [
|
94
|
|
- {
|
95
|
|
- "additionalClassifications":
|
96
|
|
- [
|
97
|
|
- {
|
98
|
|
- "description": u"Послуги щодо забезпечення харчуванням, інші",
|
99
|
|
- "id": "56.29",
|
100
|
|
- "scheme": u"ДКПП"
|
101
|
|
- }
|
102
|
|
- ],
|
103
|
|
- "classification":
|
104
|
|
- {
|
105
|
|
- "description": u"Послуги з організації шкільного харчування",
|
106
|
|
- "id": "55523100-3",
|
107
|
|
- "scheme": "CPV"
|
108
|
|
- },
|
109
|
|
- "description": field_with_id('i', fake.sentence(nb_words=10, variable_nb_words=True)),
|
110
|
|
- "id": "2dc54675d6364e2baffbc0f8e74432ac",
|
111
|
|
- "deliveryDate": {
|
112
|
|
- "endDate": (now + timedelta(days=5)).isoformat()
|
113
|
|
- },
|
114
|
|
- "deliveryLocation": {
|
115
|
|
- "latitude": 49.8500,
|
116
|
|
- "longitude": 24.0167
|
117
|
|
- },
|
118
|
|
- "deliveryAddress": {
|
119
|
|
- "countryName": u"Україна",
|
120
|
|
- "countryName_ru": u"Украина",
|
121
|
|
- "countryName_en": "Ukraine",
|
122
|
|
- "postalCode": fake.postalcode(),
|
123
|
|
- "region": u"м. Київ",
|
124
|
|
- "locality": u"м. Київ",
|
125
|
|
- "streetAddress": fake.street_address()
|
126
|
|
- }
|
127
|
|
- }
|
128
|
|
- ],
|
129
|
|
- "mode": "test",
|
130
|
|
- "procurementMethod": "limited",
|
131
|
|
- "procurementMethodType": procurement_method_type,
|
132
|
|
- "procuringEntity":
|
133
|
|
- {
|
134
|
|
- "address":
|
135
|
|
- {
|
136
|
|
- "countryName": u"Україна",
|
137
|
|
- "locality": u"м. Вінниця",
|
138
|
|
- "postalCode": "21027",
|
139
|
|
- "region": u"м. Вінниця",
|
140
|
|
- "streetAddress": u"вул. Стахурського. 22"
|
141
|
|
- },
|
142
|
|
- "contactPoint":
|
143
|
|
- {
|
144
|
|
- "name": u"Куца Світлана Валентинівна",
|
145
|
|
- "telephone": "+380 (432) 46-53-02",
|
146
|
|
- "url": "http://sch10.edu.vn.ua/"
|
147
|
|
- },
|
148
|
|
- "identifier":
|
149
|
|
- {
|
150
|
|
- "id": "21725150",
|
151
|
|
- "legalName": u"Заклад \"Загальноосвітня школа І-ІІІ ступенів № 10 Вінницької міської ради\"",
|
152
|
|
- "scheme": u"UA-EDR"
|
153
|
|
- },
|
154
|
|
- "name": u"ЗОСШ #10 м.Вінниці",
|
155
|
|
- "kind": "general"
|
156
|
|
- },
|
157
|
|
- "value": {
|
158
|
|
- "amount": 500000,
|
159
|
|
- "currency": "UAH",
|
160
|
|
- "valueAddedTaxIncluded": True
|
161
|
|
- },
|
162
|
|
- "description": fake.sentence(nb_words=10, variable_nb_words=True),
|
163
|
|
- "description_en": fake.sentence(nb_words=10, variable_nb_words=True),
|
164
|
|
- "description_ru": fake.sentence(nb_words=10, variable_nb_words=True),
|
165
|
|
- "title": fake.catch_phrase(),
|
166
|
|
- "title_en": fake.catch_phrase(),
|
167
|
|
- "title_ru": fake.catch_phrase()
|
168
|
|
- }
|
|
91
|
+ data = test_tender_data(intervals)
|
|
92
|
+ del data["submissionMethodDetails"]
|
|
93
|
+ del data["minimalStep"]
|
|
94
|
+ del data["enquiryPeriod"]
|
|
95
|
+ del data["tenderPeriod"]
|
|
96
|
+ data["procuringEntity"]["kind"] = "general"
|
|
97
|
+ data.update({"procurementMethodType": procurement_method_type, "procurementMethod": "limited"})
|
169
|
98
|
if procurement_method_type == "negotiation":
|
170
|
99
|
cause_variants = (
|
171
|
100
|
"artContestIP",
|
...
|
...
|
@@ -181,13 +110,12 @@ def test_tender_data_limited(intervals, procurement_method_type): |
181
|
110
|
cause_variants = ('quick',)
|
182
|
111
|
cause = fake.random_element(cause_variants)
|
183
|
112
|
data.update({"cause": cause})
|
184
|
|
- if procurement_method_type == "negotiation" \
|
185
|
|
- or procurement_method_type == "negotiation.quick":
|
|
113
|
+ if procurement_method_type in ("negotiation", "negotiation.quick"):
|
186
|
114
|
data.update({
|
187
|
115
|
"procurementMethodDetails": "quick, accelerator=1440",
|
188
|
|
- "causeDescription": fake.sentence(nb_words=10, variable_nb_words=True)
|
|
116
|
+ "causeDescription": fake.description()
|
189
|
117
|
})
|
190
|
|
- return data
|
|
118
|
+ return munchify(data)
|
191
|
119
|
|
192
|
120
|
|
193
|
121
|
def test_tender_data_multiple_items(intervals):
|
...
|
...
|
@@ -195,16 +123,18 @@ def test_tender_data_multiple_items(intervals): |
195
|
123
|
for _ in range(4):
|
196
|
124
|
new_item = test_item_data()
|
197
|
125
|
t_data['items'].append(new_item)
|
198
|
|
- return t_data
|
|
126
|
+ return munchify(t_data)
|
199
|
127
|
|
200
|
128
|
|
201
|
129
|
def test_tender_data_multiple_lots(intervals):
|
202
|
130
|
tender = test_tender_data(intervals)
|
203
|
131
|
first_lot_id = "3c8f387879de4c38957402dbdb8b31af"
|
204
|
132
|
tender['items'][0]['relatedLot'] = first_lot_id
|
205
|
|
- tender['lots'] = [test_lot_data()]
|
|
133
|
+ tender['lots'] = [test_lot_data(tender['value']['amount'])]
|
206
|
134
|
tender['lots'][0]['id'] = first_lot_id
|
207
|
|
- return tender
|
|
135
|
+ max_lot_value_amount = max([lot['value']['amount'] for lot in tender['lots']])
|
|
136
|
+ tender['value']['amount'] = max_lot_value_amount
|
|
137
|
+ return munchify(tender)
|
208
|
138
|
|
209
|
139
|
|
210
|
140
|
def test_tender_data_meat(intervals):
|
...
|
...
|
@@ -215,24 +145,24 @@ def test_tender_data_meat(intervals): |
215
|
145
|
{
|
216
|
146
|
"code": "ee3e24bc17234a41bd3e3a04cc28e9c6",
|
217
|
147
|
"featureOf": "tenderer",
|
218
|
|
- "title": field_with_id('f', "Термін оплати"),
|
219
|
|
- "description": "Умови відстрочки платежу після поставки товару",
|
|
148
|
+ "title": field_with_id("f", fake.title()),
|
|
149
|
+ "description": fake.description(),
|
220
|
150
|
"enum": [
|
221
|
151
|
{
|
222
|
152
|
"value": 0.15,
|
223
|
|
- "title": "180 днів та більше"
|
|
153
|
+ "title": fake.word()
|
224
|
154
|
},
|
225
|
155
|
{
|
226
|
156
|
"value": 0.1,
|
227
|
|
- "title": "90-179 днів",
|
|
157
|
+ "title": fake.word()
|
228
|
158
|
},
|
229
|
159
|
{
|
230
|
160
|
"value": 0.05,
|
231
|
|
- "title": "30-89 днів"
|
|
161
|
+ "title": fake.word()
|
232
|
162
|
},
|
233
|
163
|
{
|
234
|
164
|
"value": 0,
|
235
|
|
- "title": "Менше 30 днів"
|
|
165
|
+ "title": fake.word()
|
236
|
166
|
}
|
237
|
167
|
]
|
238
|
168
|
},
|
...
|
...
|
@@ -240,56 +170,35 @@ def test_tender_data_meat(intervals): |
240
|
170
|
"code": "48cfd91612c04125ab406374d7cc8d93",
|
241
|
171
|
"featureOf": "item",
|
242
|
172
|
"relatedItem": item_id,
|
243
|
|
- "title": field_with_id('f', "Сорт"),
|
244
|
|
- "description": "Сорт продукції",
|
|
173
|
+ "title": field_with_id("f", fake.title()),
|
|
174
|
+ "description": fake.description(),
|
245
|
175
|
"enum": [
|
246
|
176
|
{
|
247
|
177
|
"value": 0.05,
|
248
|
|
- "title": "Вищий"
|
|
178
|
+ "title": fake.word()
|
249
|
179
|
},
|
250
|
180
|
{
|
251
|
181
|
"value": 0.01,
|
252
|
|
- "title": "Перший",
|
|
182
|
+ "title": fake.word()
|
253
|
183
|
},
|
254
|
184
|
{
|
255
|
185
|
"value": 0,
|
256
|
|
- "title": "Другий"
|
|
186
|
+ "title": fake.word()
|
257
|
187
|
}
|
258
|
188
|
]
|
259
|
189
|
}
|
260
|
190
|
]
|
261
|
|
- return tender
|
|
191
|
+ return munchify(tender)
|
262
|
192
|
|
263
|
193
|
|
264
|
194
|
def test_question_data():
|
265
|
|
- data = munchify({
|
|
195
|
+ return munchify({
|
266
|
196
|
"data": {
|
267
|
|
- "author": {
|
268
|
|
- "address": {
|
269
|
|
- "countryName": u"Україна",
|
270
|
|
- "countryName_ru": u"Украина",
|
271
|
|
- "countryName_en": "Ukraine",
|
272
|
|
- "locality": u"м. Вінниця",
|
273
|
|
- "postalCode": "21100",
|
274
|
|
- "region": u"Вінницька область",
|
275
|
|
- "streetAddress": fake.street_address()
|
276
|
|
- },
|
277
|
|
- "contactPoint": {
|
278
|
|
- "name": fake.name(),
|
279
|
|
- "telephone": fake.phone_number()
|
280
|
|
- },
|
281
|
|
- "identifier": {
|
282
|
|
- "scheme": u"UA-EDR",
|
283
|
|
- "id": u"{:08d}".format(fake.pyint()),
|
284
|
|
- "uri": fake.image_url(width=None, height=None)
|
285
|
|
- },
|
286
|
|
- "name": fake.company()
|
287
|
|
- },
|
288
|
|
- "description": fake.sentence(nb_words=10, variable_nb_words=True),
|
289
|
|
- "title": field_with_id('q', fake.sentence(nb_words=6, variable_nb_words=True))
|
|
197
|
+ "author": fake.procuringEntity(),
|
|
198
|
+ "description": fake.description(),
|
|
199
|
+ "title": field_with_id("q", fake.title())
|
290
|
200
|
}
|
291
|
201
|
})
|
292
|
|
- return data
|
293
|
202
|
|
294
|
203
|
|
295
|
204
|
def test_question_answer_data():
|
...
|
...
|
@@ -302,30 +211,10 @@ def test_question_answer_data(): |
302
|
211
|
|
303
|
212
|
def test_complaint_data(lot=False):
|
304
|
213
|
data = munchify({
|
305
|
|
- "data": {
|
306
|
|
- "author": {
|
307
|
|
- "address": {
|
308
|
|
- "countryName": u"Україна",
|
309
|
|
- "countryName_ru": u"Украина",
|
310
|
|
- "countryName_en": "Ukraine",
|
311
|
|
- "locality": u"м. Вінниця",
|
312
|
|
- "postalCode": "21100",
|
313
|
|
- "region": u"Вінницька область",
|
314
|
|
- "streetAddress": fake.street_address()
|
315
|
|
- },
|
316
|
|
- "contactPoint": {
|
317
|
|
- "name": fake.name(),
|
318
|
|
- "telephone": fake.phone_number()
|
319
|
|
- },
|
320
|
|
- "identifier": {
|
321
|
|
- "scheme": u"UA-EDR",
|
322
|
|
- "id": u"{:08d}".format(fake.pyint()),
|
323
|
|
- "uri": fake.image_url(width=None, height=None)
|
324
|
|
- },
|
325
|
|
- "name": fake.company()
|
326
|
|
- },
|
327
|
|
- "description": fake.sentence(nb_words=10, variable_nb_words=True),
|
328
|
|
- "title": fake.sentence(nb_words=6, variable_nb_words=True)
|
|
214
|
+ "data" : {
|
|
215
|
+ "author": fake.procuringEntity(),
|
|
216
|
+ "description": fake.description(),
|
|
217
|
+ "title": fake.title()
|
329
|
218
|
}
|
330
|
219
|
})
|
331
|
220
|
if lot:
|
...
|
...
|
@@ -336,17 +225,6 @@ def test_complaint_data(lot=False): |
336
|
225
|
test_claim_data = test_complaint_data
|
337
|
226
|
|
338
|
227
|
|
339
|
|
-def test_complaint_answer_data(complaint_id):
|
340
|
|
- return munchify({
|
341
|
|
- "data": {
|
342
|
|
- "id": complaint_id,
|
343
|
|
- "status": "answered",
|
344
|
|
- "resolutionType": "resolved",
|
345
|
|
- "resolution": fake.sentence(nb_words=40, variable_nb_words=True)
|
346
|
|
- }
|
347
|
|
- })
|
348
|
|
-
|
349
|
|
-
|
350
|
228
|
def test_claim_answer_satisfying_data(claim_id):
|
351
|
229
|
return munchify({
|
352
|
230
|
"data": {
|
...
|
...
|
@@ -397,14 +275,6 @@ def test_cancel_claim_data(claim_id, cancellation_reason): |
397
|
275
|
})
|
398
|
276
|
|
399
|
277
|
|
400
|
|
-def test_change_cancellation_document_field_data(key, value):
|
401
|
|
- return munchify({
|
402
|
|
- "data": {
|
403
|
|
- key: value
|
404
|
|
- }
|
405
|
|
- })
|
406
|
|
-
|
407
|
|
-
|
408
|
278
|
def test_confirm_data(id):
|
409
|
279
|
return munchify({
|
410
|
280
|
"data": {
|
...
|
...
|
@@ -431,42 +301,25 @@ def test_complaint_reply_data(): |
431
|
301
|
})
|
432
|
302
|
|
433
|
303
|
|
434
|
|
-def test_bid_data(mode):
|
|
304
|
+def test_bid_data(mode, max_value_amount):
|
435
|
305
|
bid = munchify({
|
436
|
306
|
"data": {
|
437
|
307
|
"tenderers": [
|
438
|
|
- {
|
439
|
|
- "address": {
|
440
|
|
- "countryName": u"Україна",
|
441
|
|
- "countryName_ru": u"Украина",
|
442
|
|
- "countryName_en": "Ukraine",
|
443
|
|
- "locality": u"м. Вінниця",
|
444
|
|
- "postalCode": "21100",
|
445
|
|
- "region": u"Вінницька область",
|
446
|
|
- "streetAddress": fake.street_address()
|
447
|
|
- },
|
448
|
|
- "contactPoint": {
|
449
|
|
- "name": fake.name(),
|
450
|
|
- "telephone": fake.phone_number()
|
451
|
|
- },
|
452
|
|
- "identifier": {
|
453
|
|
- "scheme": u"UA-EDR",
|
454
|
|
- "id": u"{:08d}".format(fake.pyint()),
|
455
|
|
- },
|
456
|
|
- "name": fake.company()
|
457
|
|
- }
|
|
308
|
+ fake.procuringEntity()
|
458
|
309
|
]
|
459
|
310
|
}
|
460
|
311
|
})
|
|
312
|
+ bid.data.tenderers[0].address.countryName_en = translate_country_en(bid.data.tenderers[0].address.countryName)
|
|
313
|
+ bid.data.tenderers[0].address.countryName_ru = translate_country_ru(bid.data.tenderers[0].address.countryName)
|
461
|
314
|
if 'open' in mode:
|
462
|
315
|
bid.data['selfEligible'] = True
|
463
|
316
|
bid.data['selfQualified'] = True
|
464
|
317
|
if mode == 'multiLot':
|
465
|
318
|
bid.data.lotValues = list()
|
466
|
319
|
for _ in range(2):
|
467
|
|
- bid.data.lotValues.append(test_bid_value())
|
|
320
|
+ bid.data.lotValues.append(test_bid_value(max_value_amount))
|
468
|
321
|
else:
|
469
|
|
- bid.data.update(test_bid_value())
|
|
322
|
+ bid.data.update(test_bid_value(max_value_amount))
|
470
|
323
|
if mode == 'meat':
|
471
|
324
|
bid.data.update(test_bid_params())
|
472
|
325
|
return bid
|
...
|
...
|
@@ -486,11 +339,11 @@ def test_bid_params(): |
486
|
339
|
]
|
487
|
340
|
})
|
488
|
341
|
|
489
|
|
-def test_bid_value():
|
|
342
|
+def test_bid_value(max_value_amount):
|
490
|
343
|
return munchify({
|
491
|
344
|
"value": {
|
492
|
345
|
"currency": "UAH",
|
493
|
|
- "amount": fake.random_int(max=1999),
|
|
346
|
+ "amount": round(random.uniform(1, max_value_amount), 2),
|
494
|
347
|
"valueAddedTaxIncluded": True
|
495
|
348
|
}
|
496
|
349
|
})
|
...
|
...
|
@@ -500,30 +353,10 @@ def test_supplier_data(): |
500
|
353
|
return munchify({
|
501
|
354
|
"data": {
|
502
|
355
|
"suppliers": [
|
503
|
|
- {
|
504
|
|
- "address": {
|
505
|
|
- "countryName": u"Україна",
|
506
|
|
- "locality": u"м. Вінниця",
|
507
|
|
- "postalCode": "21100",
|
508
|
|
- "region": u"м. Вінниця",
|
509
|
|
- "streetAddress": u"вул. Островського, 33"
|
510
|
|
- },
|
511
|
|
- "contactPoint": {
|
512
|
|
- "email": "soleksuk@gmail.com",
|
513
|
|
- "name": u"Сергій Олексюк",
|
514
|
|
- "telephone": "+380 (432) 21-69-30"
|
515
|
|
- },
|
516
|
|
- "identifier": {
|
517
|
|
- "id": "13313462",
|
518
|
|
- "legalName": u"Державне комунальне підприємство громадського харчування «Школяр»",
|
519
|
|
- "scheme": "UA-EDR",
|
520
|
|
- "uri": "http://sch10.edu.vn.ua/"
|
521
|
|
- },
|
522
|
|
- "name": u"ДКП «Школяр»"
|
523
|
|
- }
|
|
356
|
+ fake.procuringEntity()
|
524
|
357
|
],
|
525
|
358
|
"value": {
|
526
|
|
- "amount": 475000,
|
|
359
|
+ "amount": fake.random_int(min=1),
|
527
|
360
|
"currency": "UAH",
|
528
|
361
|
"valueAddedTaxIncluded": True
|
529
|
362
|
}
|
...
|
...
|
@@ -531,52 +364,14 @@ def test_supplier_data(): |
531
|
364
|
})
|
532
|
365
|
|
533
|
366
|
|
534
|
|
-def test_award_data():
|
535
|
|
- return munchify({'data': {}})
|
536
|
|
-
|
537
|
|
-
|
538
|
|
-def test_item_data():
|
539
|
|
- now = get_now()
|
540
|
|
- return munchify({
|
541
|
|
- "description": field_with_id('i', fake.catch_phrase()),
|
542
|
|
- "deliveryDate": {
|
543
|
|
- "endDate": (now + timedelta(days=5)).isoformat()
|
544
|
|
- },
|
545
|
|
- "deliveryLocation": {
|
546
|
|
- "latitude": 49.8500,
|
547
|
|
- "longitude": 24.0167
|
548
|
|
- },
|
549
|
|
- "deliveryAddress": {
|
550
|
|
- "countryName": u"Україна",
|
551
|
|
- "countryName_ru": u"Украина",
|
552
|
|
- "countryName_en": "Ukraine",
|
553
|
|
- "postalCode": fake.postalcode(),
|
554
|
|
- "region": u"м. Київ",
|
555
|
|
- "locality": u"м. Київ",
|
556
|
|
- "streetAddress": fake.street_address()
|
557
|
|
- },
|
558
|
|
- "classification": {
|
559
|
|
- "scheme": u"CPV",
|
560
|
|
- "id": u"44617100-9",
|
561
|
|
- "description": u"Картонні коробки",
|
562
|
|
- "description_ru": u"Большие картонные коробки",
|
563
|
|
- "description_en": u"Cartons"
|
564
|
|
- },
|
565
|
|
- "additionalClassifications": [
|
566
|
|
- {
|
567
|
|
- "scheme": u"ДКПП",
|
568
|
|
- "id": u"17.21.1",
|
569
|
|
- "description": u"Папір і картон гофровані, паперова й картонна тара"
|
570
|
|
- }
|
571
|
|
- ],
|
572
|
|
- "unit": {
|
573
|
|
- "name": u"кілограм",
|
574
|
|
- "name_ru": u"килограмм",
|
575
|
|
- "name_en": "kilogram",
|
576
|
|
- "code": u"KGM"
|
577
|
|
- },
|
578
|
|
- "quantity": fake.pyint()
|
579
|
|
- })
|
|
367
|
+def test_item_data(cpv=None):
|
|
368
|
+ data = fake.fake_item(cpv)
|
|
369
|
+ data["description"] = field_with_id("i", data["description"])
|
|
370
|
+ days = fake.random_int(min=1, max=30)
|
|
371
|
+ data["deliveryDate"] = {"endDate": (get_now() + timedelta(days=days)).isoformat()}
|
|
372
|
+ data["deliveryAddress"]["countryName_en"] = translate_country_en(data["deliveryAddress"]["countryName"])
|
|
373
|
+ data["deliveryAddress"]["countryName_ru"] = translate_country_ru(data["deliveryAddress"]["countryName"])
|
|
374
|
+ return munchify(data)
|
580
|
375
|
|
581
|
376
|
|
582
|
377
|
def test_invalid_features_data():
|
...
|
...
|
@@ -584,16 +379,16 @@ def test_invalid_features_data(): |
584
|
379
|
{
|
585
|
380
|
"code": "ee3e24bc17234a41bd3e3a04cc28e9c6",
|
586
|
381
|
"featureOf": "tenderer",
|
587
|
|
- "title": "Термін оплати",
|
588
|
|
- "description": "Умови відстрочки платежу після поставки товару",
|
|
382
|
+ "title": fake.title(),
|
|
383
|
+ "description": fake.description(),
|
589
|
384
|
"enum": [
|
590
|
385
|
{
|
591
|
386
|
"value": 0.35,
|
592
|
|
- "title": "180 днів та більше"
|
|
387
|
+ "title": fake.word()
|
593
|
388
|
},
|
594
|
389
|
{
|
595
|
390
|
"value": 0,
|
596
|
|
- "title": "Менше 30 днів"
|
|
391
|
+ "title": fake.word()
|
597
|
392
|
}
|
598
|
393
|
]
|
599
|
394
|
},
|
...
|
...
|
@@ -601,35 +396,36 @@ def test_invalid_features_data(): |
601
|
396
|
"code": "48cfd91612c04125ab406374d7cc8d93",
|
602
|
397
|
"featureOf": "item",
|
603
|
398
|
"relatedItem": "edd0032574bf4402877ad5f362df225a",
|
604
|
|
- "title": "Сорт",
|
605
|
|
- "description": "Сорт продукції",
|
|
399
|
+ "title": fake.title(),
|
|
400
|
+ "description": fake.description(),
|
606
|
401
|
"enum": [
|
607
|
402
|
{
|
608
|
403
|
"value": 0.35,
|
609
|
|
- "title": "Вищий"
|
|
404
|
+ "title": fake.word()
|
610
|
405
|
},
|
611
|
406
|
{
|
612
|
407
|
"value": 0,
|
613
|
|
- "title": "Другий"
|
|
408
|
+ "title": fake.word()
|
614
|
409
|
}
|
615
|
410
|
]
|
616
|
411
|
}
|
617
|
412
|
]
|
618
|
413
|
|
619
|
414
|
|
620
|
|
-def test_lot_data():
|
|
415
|
+def test_lot_data(max_value_amount):
|
|
416
|
+ value_amount = round(random.uniform(1, max_value_amount), 2)
|
621
|
417
|
return munchify(
|
622
|
418
|
{
|
623
|
|
- "description": fake.sentence(nb_words=10, variable_nb_words=True),
|
624
|
|
- "title": field_with_id('l', fake.sentence(nb_words=6, variable_nb_words=True)),
|
|
419
|
+ "description": fake.description(),
|
|
420
|
+ "title": field_with_id('l', fake.title()),
|
625
|
421
|
"value": {
|
626
|
422
|
"currency": "UAH",
|
627
|
|
- "amount": 2000 + fake.pyfloat(left_digits=4, right_digits=1, positive=True),
|
|
423
|
+ "amount": value_amount,
|
628
|
424
|
"valueAddedTaxIncluded": True
|
629
|
425
|
},
|
630
|
426
|
"minimalStep": {
|
631
|
427
|
"currency": "UAH",
|
632
|
|
- "amount": 30.0,
|
|
428
|
+ "amount": round(random.uniform(0.005, 0.03) * value_amount, 2),
|
633
|
429
|
"valueAddedTaxIncluded": True
|
634
|
430
|
},
|
635
|
431
|
"status": "active"
|
...
|
...
|
|