Showing
1 changed file
with
50 additions
and
259 deletions
@@ -168,187 +168,30 @@ def test_tender_data_limited(intervals): | @@ -168,187 +168,30 @@ def test_tender_data_limited(intervals): | ||
168 | def test_tender_data_multiple_items(intervals): | 168 | def test_tender_data_multiple_items(intervals): |
169 | now = get_now() | 169 | now = get_now() |
170 | t_data = test_tender_data(intervals) | 170 | t_data = test_tender_data(intervals) |
171 | - t_data.update({ | ||
172 | - "items": [ | ||
173 | - { | ||
174 | - "description": fake.catch_phrase(), | ||
175 | - "deliveryDate": { | ||
176 | - "endDate": (now + timedelta(days=5)).isoformat() | ||
177 | - }, | ||
178 | - "deliveryLocation": { | ||
179 | - "latitude": 49.8500, | ||
180 | - "longitude": 24.0167 | ||
181 | - }, | ||
182 | - "deliveryAddress": { | ||
183 | - "countryName": u"Україна", | ||
184 | - "countryName_ru": u"Украина", | ||
185 | - "countryName_en": "Ukraine", | ||
186 | - "postalCode": "01008", | ||
187 | - "region": u"м. Київ", | ||
188 | - "locality": u"м. Київ", | ||
189 | - "streetAddress": u"ул. Грушевского, 12/2" | ||
190 | - }, | ||
191 | - "classification": { | ||
192 | - "scheme": u"CPV", | ||
193 | - "id": u"44617100-9", | ||
194 | - "description": u"Картонки", | ||
195 | - "description_ru": u"Большие картонные коробки", | ||
196 | - "description_en": u"Cartons" | ||
197 | - }, | ||
198 | - "additionalClassifications": [ | ||
199 | - { | ||
200 | - "scheme": u"ДКПП", | ||
201 | - "id": u"17.29.12-00.00", | ||
202 | - "description": u"Блоки, плити та пластини фільтрувальні, з паперової маси" | ||
203 | - } | ||
204 | - ], | ||
205 | - "unit": { | ||
206 | - "name": u"кілограм", | ||
207 | - "name_ru": u"килограмм", | ||
208 | - "name_en": "kilogram", | ||
209 | - "code": u"KGM" | ||
210 | - }, | ||
211 | - "quantity": fake.pyint() | ||
212 | - }, | ||
213 | - { | ||
214 | - "description": fake.catch_phrase(), | ||
215 | - "deliveryDate": { | ||
216 | - "endDate": (now + timedelta(days=5)).isoformat() | ||
217 | - }, | ||
218 | - "deliveryLocation": { | ||
219 | - "latitude": 49.8500, | ||
220 | - "longitude": 24.0167 | ||
221 | - }, | ||
222 | - "deliveryAddress": { | ||
223 | - "countryName": u"Україна", | ||
224 | - "countryName_ru": u"Украина", | ||
225 | - "countryName_en": "Ukraine", | ||
226 | - "postalCode": fake.postalcode(), | ||
227 | - "region": u"м. Київ", | ||
228 | - "locality": u"м. Київ", | ||
229 | - "streetAddress": fake.street_address() | ||
230 | - }, | ||
231 | - "classification": { | ||
232 | - "scheme": u"CPV", | ||
233 | - "id": u"44617100-9", | ||
234 | - "description": u"Картонки", | ||
235 | - "description_ru": u"Большие картонные коробки", | ||
236 | - "description_en": u"Cartons" | ||
237 | - }, | ||
238 | - "additionalClassifications": [ | ||
239 | - { | ||
240 | - "scheme": u"ДКПП", | ||
241 | - "id": u"17.21.99-00.00", | ||
242 | - "description": u"Роботи субпідрядні як частина виробництва гофрованих паперу й картону, паперової та картонної тари" | ||
243 | - } | ||
244 | - ], | ||
245 | - "unit": { | ||
246 | - "name": u"кілограм", | ||
247 | - "name_ru": u"килограмм", | ||
248 | - "name_en": "kilogram", | ||
249 | - "code": u"KGM" | ||
250 | - }, | ||
251 | - "quantity": fake.pyint() | ||
252 | - }, | ||
253 | - { | ||
254 | - "description": fake.catch_phrase(), | ||
255 | - "deliveryDate": { | ||
256 | - "endDate": (now + timedelta(days=5)).isoformat() | ||
257 | - }, | ||
258 | - "deliveryLocation": { | ||
259 | - "latitude": 49.3418, | ||
260 | - "longitude": 39.1829 | ||
261 | - }, | ||
262 | - "deliveryAddress": { | ||
263 | - "countryName": u"Україна", | ||
264 | - "countryName_ru": u"Украина", | ||
265 | - "countryName_en": "Ukraine", | ||
266 | - "postalCode": fake.postalcode(), | ||
267 | - "region": u"Луганська область", | ||
268 | - "locality": u"м. Луганськ", | ||
269 | - "streetAddress": u"Вул. Оборонна 28" | ||
270 | - }, | ||
271 | - "classification": { | ||
272 | - "scheme": u"CPV", | ||
273 | - "id": u"44617100-9", | ||
274 | - "description": u"Картонки", | ||
275 | - "description_ru": u"Большие картонные коробки", | ||
276 | - "description_en": u"Cartons" | ||
277 | - }, | ||
278 | - "additionalClassifications": [ | ||
279 | - { | ||
280 | - "scheme": u"ДКПП", | ||
281 | - "id": u"17.22.12-40.00", | ||
282 | - "description": u"Вата; вироби з вати, інші" | ||
283 | - } | ||
284 | - ], | ||
285 | - "unit": { | ||
286 | - "name": u"кілограм", | ||
287 | - "name_ru": u"килограмм", | ||
288 | - "name_en": "kilogram", | ||
289 | - "code": u"KGM" | ||
290 | - }, | ||
291 | - "quantity": fake.pyint() | ||
292 | - }, | ||
293 | - { | ||
294 | - "description": fake.catch_phrase(), | ||
295 | - "deliveryDate": { | ||
296 | - "endDate": (now + timedelta(days=5)).isoformat() | ||
297 | - }, | ||
298 | - "deliveryLocation": { | ||
299 | - "latitude": 49.8500, | ||
300 | - "longitude": 24.0167 | ||
301 | - }, | ||
302 | - "deliveryAddress": { | ||
303 | - "countryName": u"Україна", | ||
304 | - "countryName_ru": u"Украина", | ||
305 | - "countryName_en": "Ukraine", | ||
306 | - "postalCode": fake.postalcode(), | ||
307 | - "region": u"м. Київ", | ||
308 | - "locality": u"м. Київ", | ||
309 | - "streetAddress": fake.street_address() | ||
310 | - }, | ||
311 | - "classification": { | ||
312 | - "scheme": u"CPV", | ||
313 | - "id": u"44617100-9", | ||
314 | - "description": u"Картонки", | ||
315 | - "description_ru": u"Большие картонные коробки", | ||
316 | - "description_en": u"Cartons" | ||
317 | - }, | ||
318 | - "additionalClassifications": [ | ||
319 | - { | ||
320 | - "scheme": u"ДКПП", | ||
321 | - "id": u"17.22.12-50.00", | ||
322 | - "description": u"Одяг і речі до одягу з паперової маси, паперу, целюлозної вати чи полотна з целюлозного волокна (крім носових хусточок, наголовних уборів)" | ||
323 | - } | ||
324 | - ], | ||
325 | - "unit": { | ||
326 | - "name": u"кілограм", | ||
327 | - "name_ru": u"килограмм", | ||
328 | - "name_en": "kilogram", | ||
329 | - "code": u"KGM" | ||
330 | - }, | ||
331 | - "quantity": fake.pyint() | ||
332 | - } | ||
333 | - ] | ||
334 | - }) | 171 | + for _ in range(4): |
172 | + new_item = test_item_data() | ||
173 | + t_data['items'].append(new_item) | ||
335 | return t_data | 174 | return t_data |
336 | 175 | ||
337 | 176 | ||
338 | def test_tender_data_multiple_lots(t_data): | 177 | def test_tender_data_multiple_lots(t_data): |
339 | - for i in range(3): | ||
340 | - t_data['data']['items'][i]['relatedLot'] = "3c8f387879de4c38957402dbdb8b31af" | ||
341 | - t_data['data']['items'][3]['relatedLot'] = "bcac8d2ceb5f4227b841a2211f5cb646" | 178 | + first_lot_id = "3c8f387879de4c38957402dbdb8b31af" |
179 | + second_lot_id = "bcac8d2ceb5f4227b841a2211f5cb646" | ||
180 | + | ||
181 | + for item in t_data['data']['items'][:-1]: | ||
182 | + item['relatedLot'] = first_lot_id | ||
183 | + t_data['data']['items'][-1]['relatedLot'] = second_lot_id | ||
184 | + | ||
342 | t_data['data']['lots'] = [ | 185 | t_data['data']['lots'] = [ |
343 | { | 186 | { |
344 | - "id": "3c8f387879de4c38957402dbdb8b31af", | 187 | + "id": first_lot_id, |
345 | "title": "Lot #1: Kyiv stationery", | 188 | "title": "Lot #1: Kyiv stationery", |
346 | "description": "Items for Kyiv office", | 189 | "description": "Items for Kyiv office", |
347 | "value": {"currency": "UAH", "amount": 34000.0, "valueAddedTaxIncluded": "true"}, | 190 | "value": {"currency": "UAH", "amount": 34000.0, "valueAddedTaxIncluded": "true"}, |
348 | "minimalStep": {"currency": "UAH", "amount": 30.0, "valueAddedTaxIncluded": "true"}, | 191 | "minimalStep": {"currency": "UAH", "amount": 30.0, "valueAddedTaxIncluded": "true"}, |
349 | "status": "active" | 192 | "status": "active" |
350 | }, { | 193 | }, { |
351 | - "id": "bcac8d2ceb5f4227b841a2211f5cb646", | 194 | + "id": second_lot_id, |
352 | "title": "Lot #2: Lviv stationery", | 195 | "title": "Lot #2: Lviv stationery", |
353 | "description": "Items for Lviv office", | 196 | "description": "Items for Lviv office", |
354 | "value": {"currency": "UAH", "amount": 9000.0, "valueAddedTaxIncluded": "true"}, | 197 | "value": {"currency": "UAH", "amount": 9000.0, "valueAddedTaxIncluded": "true"}, |
@@ -514,97 +357,57 @@ def test_bid_data(): | @@ -514,97 +357,57 @@ def test_bid_data(): | ||
514 | } | 357 | } |
515 | ], | 358 | ], |
516 | "value": { | 359 | "value": { |
517 | - "amount": 500 | 360 | + "currency": "UAH", |
361 | + "amount": 500, | ||
362 | + "valueAddedTaxIncluded": "true" | ||
518 | } | 363 | } |
519 | } | 364 | } |
520 | }) | 365 | }) |
521 | 366 | ||
522 | 367 | ||
523 | def test_bid_data_meat_tender(): | 368 | def test_bid_data_meat_tender(): |
524 | - return munchify({ | ||
525 | - "data": { | ||
526 | - "tenderers": [ | ||
527 | - { | ||
528 | - "address": { | ||
529 | - "countryName": "Україна", | ||
530 | - "locality": "м. Вінниця", | ||
531 | - "postalCode": "21100", | ||
532 | - "region": "м. Вінниця", | ||
533 | - "streetAddress": fake.street_address() | ||
534 | - }, | ||
535 | - "contactPoint": { | ||
536 | - "name": fake.name(), | ||
537 | - "telephone": fake.phone_number() | ||
538 | - }, | ||
539 | - "identifier": { | ||
540 | - "scheme": u"UA-EDR", | ||
541 | - "id": u"{:08d}".format(fake.pyint()), | ||
542 | - }, | ||
543 | - "name": fake.company() | ||
544 | - } | ||
545 | - ], | ||
546 | - "parameters": [ | ||
547 | - { | ||
548 | - "code": "ee3e24bc17234a41bd3e3a04cc28e9c6", | ||
549 | - "value": fake.random_element(elements=(0.15, 0.1, 0.05, 0)) | ||
550 | - }, | ||
551 | - { | ||
552 | - "code": "48cfd91612c04125ab406374d7cc8d93", | ||
553 | - "value": fake.random_element(elements=(0.05, 0.01, 0)) | ||
554 | - } | ||
555 | - ], | ||
556 | - "value": { | ||
557 | - "amount": 500 | 369 | + bid = test_bid_data() |
370 | + bid.data.update({ | ||
371 | + "parameters": [ | ||
372 | + { | ||
373 | + "code": "ee3e24bc17234a41bd3e3a04cc28e9c6", | ||
374 | + "value": fake.random_element(elements=(0.15, 0.1, 0.05, 0)) | ||
375 | + }, | ||
376 | + { | ||
377 | + "code": "48cfd91612c04125ab406374d7cc8d93", | ||
378 | + "value": fake.random_element(elements=(0.05, 0.01, 0)) | ||
558 | } | 379 | } |
559 | - } | 380 | + ] |
560 | }) | 381 | }) |
382 | + return bid | ||
561 | 383 | ||
562 | 384 | ||
563 | def test_lots_bid_data(): | 385 | def test_lots_bid_data(): |
564 | - return munchify({ | ||
565 | - "data": { | ||
566 | - "tenderers": [ | ||
567 | - { | ||
568 | - "address": { | ||
569 | - "countryName": "Україна", | ||
570 | - "locality": "м. Вінниця", | ||
571 | - "postalCode": "21100", | ||
572 | - "region": "м. Вінниця", | ||
573 | - "streetAddress": fake.street_address() | ||
574 | - }, | ||
575 | - "contactPoint": { | ||
576 | - "name": fake.name(), | ||
577 | - "telephone": fake.phone_number() | ||
578 | - }, | ||
579 | - "identifier": { | ||
580 | - "scheme": u"UA-EDR", | ||
581 | - "id": u"{:08d}".format(fake.pyint()), | ||
582 | - }, | ||
583 | - "name": fake.company() | ||
584 | - } | ||
585 | - ], | ||
586 | - "lotValues": [ | ||
587 | - { | ||
588 | - "value": { | ||
589 | - "currency": "UAH", | ||
590 | - "amount": 1000 + fake.pyfloat(left_digits=3, right_digits=0, positive=True), | ||
591 | - "valueAddedTaxIncluded": "true" | ||
592 | - }, | ||
593 | - "relatedLot": "3c8f387879de4c38957402dbdb8b31af", | ||
594 | - "date": "2015-11-01T12:43:12.482645+02:00" | 386 | + bid = test_bid_data() |
387 | + del bid.data.value | ||
388 | + bid.data.update({ | ||
389 | + "lotValues": [ | ||
390 | + { | ||
391 | + "value": { | ||
392 | + "currency": "UAH", | ||
393 | + "amount": 1000 + fake.pyfloat(left_digits=3, right_digits=0, positive=True), | ||
394 | + "valueAddedTaxIncluded": "true" | ||
595 | }, | 395 | }, |
596 | - { | ||
597 | - "value": { | ||
598 | - "currency": "UAH", | ||
599 | - "amount": 1000 + fake.pyfloat(left_digits=3, right_digits=0, positive=True), | ||
600 | - "valueAddedTaxIncluded": "true" | ||
601 | - }, | ||
602 | - "relatedLot": "bcac8d2ceb5f4227b841a2211f5cb646", | ||
603 | - "date": "2015-11-01T12:43:12.482645+02:00" | ||
604 | - } | ||
605 | - ] | ||
606 | - } | 396 | + "relatedLot": "3c8f387879de4c38957402dbdb8b31af", |
397 | + "date": "2015-11-01T12:43:12.482645+02:00" | ||
398 | + }, | ||
399 | + { | ||
400 | + "value": { | ||
401 | + "currency": "UAH", | ||
402 | + "amount": 1000 + fake.pyfloat(left_digits=3, right_digits=0, positive=True), | ||
403 | + "valueAddedTaxIncluded": "true" | ||
404 | + }, | ||
405 | + "relatedLot": "bcac8d2ceb5f4227b841a2211f5cb646", | ||
406 | + "date": "2015-11-01T12:43:12.482645+02:00" | ||
407 | + } | ||
408 | + ] | ||
607 | }) | 409 | }) |
410 | + return bid | ||
608 | 411 | ||
609 | 412 | ||
610 | def auction_bid(): | 413 | def auction_bid(): |
@@ -715,14 +518,6 @@ def test_invalid_features_data(): | @@ -715,14 +518,6 @@ def test_invalid_features_data(): | ||
715 | "title": "180 днів та більше" | 518 | "title": "180 днів та більше" |
716 | }, | 519 | }, |
717 | { | 520 | { |
718 | - "value": 0.1, | ||
719 | - "title": "90-179 днів", | ||
720 | - }, | ||
721 | - { | ||
722 | - "value": 0.05, | ||
723 | - "title": "30-89 днів" | ||
724 | - }, | ||
725 | - { | ||
726 | "value": 0, | 521 | "value": 0, |
727 | "title": "Менше 30 днів" | 522 | "title": "Менше 30 днів" |
728 | } | 523 | } |
@@ -740,10 +535,6 @@ def test_invalid_features_data(): | @@ -740,10 +535,6 @@ def test_invalid_features_data(): | ||
740 | "title": "Вищий" | 535 | "title": "Вищий" |
741 | }, | 536 | }, |
742 | { | 537 | { |
743 | - "value": 0.01, | ||
744 | - "title": "Перший", | ||
745 | - }, | ||
746 | - { | ||
747 | "value": 0, | 538 | "value": 0, |
748 | "title": "Другий" | 539 | "title": "Другий" |
749 | } | 540 | } |
Please
register
or
login
to post a comment