Showing
2 changed files
with
94 additions
and
303 deletions
@@ -4,11 +4,14 @@ from faker import Factory | @@ -4,11 +4,14 @@ from faker import Factory | ||
4 | from munch import munchify | 4 | from munch import munchify |
5 | from tempfile import NamedTemporaryFile | 5 | from tempfile import NamedTemporaryFile |
6 | from .local_time import get_now | 6 | from .local_time import get_now |
7 | +from .op_faker import OP_Provider | ||
7 | import random | 8 | import random |
8 | 9 | ||
10 | + | ||
9 | fake = Factory.create('uk_UA') | 11 | fake = Factory.create('uk_UA') |
10 | fake_ru = Factory.create('ru') | 12 | fake_ru = Factory.create('ru') |
11 | fake_en = Factory.create() | 13 | fake_en = Factory.create() |
14 | +fake.add_provider(OP_Provider) | ||
12 | 15 | ||
13 | 16 | ||
14 | def create_fake_sentence(): | 17 | def create_fake_sentence(): |
@@ -16,7 +19,21 @@ def create_fake_sentence(): | @@ -16,7 +19,21 @@ def create_fake_sentence(): | ||
16 | 19 | ||
17 | 20 | ||
18 | def field_with_id(prefix, sentence): | 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 | def create_fake_doc(): | 39 | def create_fake_doc(): |
@@ -30,38 +47,17 @@ def create_fake_doc(): | @@ -30,38 +47,17 @@ def create_fake_doc(): | ||
30 | 47 | ||
31 | def test_tender_data(intervals, periods=("enquiry", "tender")): | 48 | def test_tender_data(intervals, periods=("enquiry", "tender")): |
32 | now = get_now() | 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 | "mode": "test", | 52 | "mode": "test", |
37 | "submissionMethodDetails": "quick", | 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 | "value": { | 61 | "value": { |
66 | "amount": value_amount, | 62 | "amount": value_amount, |
67 | "currency": u"UAH", | 63 | "currency": u"UAH", |
@@ -73,8 +69,13 @@ def test_tender_data(intervals, periods=("enquiry", "tender")): | @@ -73,8 +69,13 @@ def test_tender_data(intervals, periods=("enquiry", "tender")): | ||
73 | }, | 69 | }, |
74 | "items": [] | 70 | "items": [] |
75 | } | 71 | } |
72 | + data["procuringEntity"]["kind"] = "other" | ||
76 | new_item = test_item_data() | 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 | period_dict = {} | 79 | period_dict = {} |
79 | inc_dt = now | 80 | inc_dt = now |
80 | for period_name in periods: | 81 | for period_name in periods: |
@@ -82,90 +83,18 @@ def test_tender_data(intervals, periods=("enquiry", "tender")): | @@ -82,90 +83,18 @@ def test_tender_data(intervals, periods=("enquiry", "tender")): | ||
82 | for i, j in zip(range(2), ("start", "end")): | 83 | for i, j in zip(range(2), ("start", "end")): |
83 | inc_dt += timedelta(minutes=intervals[period_name][i]) | 84 | inc_dt += timedelta(minutes=intervals[period_name][i]) |
84 | period_dict[period_name + "Period"][j + "Date"] = inc_dt.isoformat() | 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 | def test_tender_data_limited(intervals, procurement_method_type): | 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 | if procurement_method_type == "negotiation": | 98 | if procurement_method_type == "negotiation": |
170 | cause_variants = ( | 99 | cause_variants = ( |
171 | "artContestIP", | 100 | "artContestIP", |
@@ -181,13 +110,12 @@ def test_tender_data_limited(intervals, procurement_method_type): | @@ -181,13 +110,12 @@ def test_tender_data_limited(intervals, procurement_method_type): | ||
181 | cause_variants = ('quick',) | 110 | cause_variants = ('quick',) |
182 | cause = fake.random_element(cause_variants) | 111 | cause = fake.random_element(cause_variants) |
183 | data.update({"cause": cause}) | 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 | data.update({ | 114 | data.update({ |
187 | "procurementMethodDetails": "quick, accelerator=1440", | 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 | def test_tender_data_multiple_items(intervals): | 121 | def test_tender_data_multiple_items(intervals): |
@@ -195,7 +123,7 @@ def test_tender_data_multiple_items(intervals): | @@ -195,7 +123,7 @@ def test_tender_data_multiple_items(intervals): | ||
195 | for _ in range(4): | 123 | for _ in range(4): |
196 | new_item = test_item_data() | 124 | new_item = test_item_data() |
197 | t_data['items'].append(new_item) | 125 | t_data['items'].append(new_item) |
198 | - return t_data | 126 | + return munchify(t_data) |
199 | 127 | ||
200 | 128 | ||
201 | def test_tender_data_multiple_lots(intervals): | 129 | def test_tender_data_multiple_lots(intervals): |
@@ -204,7 +132,7 @@ def test_tender_data_multiple_lots(intervals): | @@ -204,7 +132,7 @@ def test_tender_data_multiple_lots(intervals): | ||
204 | tender['items'][0]['relatedLot'] = first_lot_id | 132 | tender['items'][0]['relatedLot'] = first_lot_id |
205 | tender['lots'] = [test_lot_data()] | 133 | tender['lots'] = [test_lot_data()] |
206 | tender['lots'][0]['id'] = first_lot_id | 134 | tender['lots'][0]['id'] = first_lot_id |
207 | - return tender | 135 | + return munchify(tender) |
208 | 136 | ||
209 | 137 | ||
210 | def test_tender_data_meat(intervals): | 138 | def test_tender_data_meat(intervals): |
@@ -215,24 +143,24 @@ def test_tender_data_meat(intervals): | @@ -215,24 +143,24 @@ def test_tender_data_meat(intervals): | ||
215 | { | 143 | { |
216 | "code": "ee3e24bc17234a41bd3e3a04cc28e9c6", | 144 | "code": "ee3e24bc17234a41bd3e3a04cc28e9c6", |
217 | "featureOf": "tenderer", | 145 | "featureOf": "tenderer", |
218 | - "title": field_with_id('f', "Термін оплати"), | ||
219 | - "description": "Умови відстрочки платежу після поставки товару", | 146 | + "title": field_with_id("f", fake.title()), |
147 | + "description": fake.description(), | ||
220 | "enum": [ | 148 | "enum": [ |
221 | { | 149 | { |
222 | "value": 0.15, | 150 | "value": 0.15, |
223 | - "title": "180 днів та більше" | 151 | + "title": fake.word() |
224 | }, | 152 | }, |
225 | { | 153 | { |
226 | "value": 0.1, | 154 | "value": 0.1, |
227 | - "title": "90-179 днів", | 155 | + "title": fake.word() |
228 | }, | 156 | }, |
229 | { | 157 | { |
230 | "value": 0.05, | 158 | "value": 0.05, |
231 | - "title": "30-89 днів" | 159 | + "title": fake.word() |
232 | }, | 160 | }, |
233 | { | 161 | { |
234 | "value": 0, | 162 | "value": 0, |
235 | - "title": "Менше 30 днів" | 163 | + "title": fake.word() |
236 | } | 164 | } |
237 | ] | 165 | ] |
238 | }, | 166 | }, |
@@ -240,56 +168,35 @@ def test_tender_data_meat(intervals): | @@ -240,56 +168,35 @@ def test_tender_data_meat(intervals): | ||
240 | "code": "48cfd91612c04125ab406374d7cc8d93", | 168 | "code": "48cfd91612c04125ab406374d7cc8d93", |
241 | "featureOf": "item", | 169 | "featureOf": "item", |
242 | "relatedItem": item_id, | 170 | "relatedItem": item_id, |
243 | - "title": field_with_id('f', "Сорт"), | ||
244 | - "description": "Сорт продукції", | 171 | + "title": field_with_id("f", fake.title()), |
172 | + "description": fake.description(), | ||
245 | "enum": [ | 173 | "enum": [ |
246 | { | 174 | { |
247 | "value": 0.05, | 175 | "value": 0.05, |
248 | - "title": "Вищий" | 176 | + "title": fake.word() |
249 | }, | 177 | }, |
250 | { | 178 | { |
251 | "value": 0.01, | 179 | "value": 0.01, |
252 | - "title": "Перший", | 180 | + "title": fake.word() |
253 | }, | 181 | }, |
254 | { | 182 | { |
255 | "value": 0, | 183 | "value": 0, |
256 | - "title": "Другий" | 184 | + "title": fake.word() |
257 | } | 185 | } |
258 | ] | 186 | ] |
259 | } | 187 | } |
260 | ] | 188 | ] |
261 | - return tender | 189 | + return munchify(tender) |
262 | 190 | ||
263 | 191 | ||
264 | def test_question_data(): | 192 | def test_question_data(): |
265 | - data = munchify({ | 193 | + return munchify({ |
266 | "data": { | 194 | "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)) | 195 | + "author": fake.procuringEntity(), |
196 | + "description": fake.description(), | ||
197 | + "title": field_with_id("q", fake.title()) | ||
290 | } | 198 | } |
291 | }) | 199 | }) |
292 | - return data | ||
293 | 200 | ||
294 | 201 | ||
295 | def test_question_answer_data(): | 202 | def test_question_answer_data(): |
@@ -302,30 +209,10 @@ def test_question_answer_data(): | @@ -302,30 +209,10 @@ def test_question_answer_data(): | ||
302 | 209 | ||
303 | def test_complaint_data(lot=False): | 210 | def test_complaint_data(lot=False): |
304 | data = munchify({ | 211 | 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) | 212 | + "data" : { |
213 | + "author": fake.procuringEntity(), | ||
214 | + "description": fake.description(), | ||
215 | + "title": fake.title() | ||
329 | } | 216 | } |
330 | }) | 217 | }) |
331 | if lot: | 218 | if lot: |
@@ -336,17 +223,6 @@ def test_complaint_data(lot=False): | @@ -336,17 +223,6 @@ def test_complaint_data(lot=False): | ||
336 | test_claim_data = test_complaint_data | 223 | test_claim_data = test_complaint_data |
337 | 224 | ||
338 | 225 | ||
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 | def test_claim_answer_satisfying_data(claim_id): | 226 | def test_claim_answer_satisfying_data(claim_id): |
351 | return munchify({ | 227 | return munchify({ |
352 | "data": { | 228 | "data": { |
@@ -397,14 +273,6 @@ def test_cancel_claim_data(claim_id, cancellation_reason): | @@ -397,14 +273,6 @@ def test_cancel_claim_data(claim_id, cancellation_reason): | ||
397 | }) | 273 | }) |
398 | 274 | ||
399 | 275 | ||
400 | -def test_change_cancellation_document_field_data(key, value): | ||
401 | - return munchify({ | ||
402 | - "data": { | ||
403 | - key: value | ||
404 | - } | ||
405 | - }) | ||
406 | - | ||
407 | - | ||
408 | def test_confirm_data(id): | 276 | def test_confirm_data(id): |
409 | return munchify({ | 277 | return munchify({ |
410 | "data": { | 278 | "data": { |
@@ -435,29 +303,12 @@ def test_bid_data(mode): | @@ -435,29 +303,12 @@ def test_bid_data(mode): | ||
435 | bid = munchify({ | 303 | bid = munchify({ |
436 | "data": { | 304 | "data": { |
437 | "tenderers": [ | 305 | "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 | - } | 306 | + fake.procuringEntity() |
458 | ] | 307 | ] |
459 | } | 308 | } |
460 | - }) | 309 | + } |
310 | + bid["data"]["tenderers"][0]["address"]["countryName_en"] = translate_country_en(bid["data"]["tenderers"][0]["address"]["countryName"]) | ||
311 | + bid["data"]["tenderers"][0]["address"]["countryName_ru"] = translate_country_ru(bid["data"]["tenderers"][0]["address"]["countryName"]) | ||
461 | if 'open' in mode: | 312 | if 'open' in mode: |
462 | bid.data['selfEligible'] = True | 313 | bid.data['selfEligible'] = True |
463 | bid.data['selfQualified'] = True | 314 | bid.data['selfQualified'] = True |
@@ -500,30 +351,10 @@ def test_supplier_data(): | @@ -500,30 +351,10 @@ def test_supplier_data(): | ||
500 | return munchify({ | 351 | return munchify({ |
501 | "data": { | 352 | "data": { |
502 | "suppliers": [ | 353 | "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 | - } | 354 | + fake.procuringEntity() |
524 | ], | 355 | ], |
525 | "value": { | 356 | "value": { |
526 | - "amount": 475000, | 357 | + "amount": fake.random_int(min=1), |
527 | "currency": "UAH", | 358 | "currency": "UAH", |
528 | "valueAddedTaxIncluded": True | 359 | "valueAddedTaxIncluded": True |
529 | } | 360 | } |
@@ -531,52 +362,14 @@ def test_supplier_data(): | @@ -531,52 +362,14 @@ def test_supplier_data(): | ||
531 | }) | 362 | }) |
532 | 363 | ||
533 | 364 | ||
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 | - }) | 365 | +def test_item_data(cpv=None): |
366 | + data = fake.fake_item(cpv) | ||
367 | + data["description"] = field_with_id("i", data["description"]) | ||
368 | + days = fake.random_int(min=1, max=30) | ||
369 | + data["deliveryDate"] = {"endDate": (get_now() + timedelta(days=days)).isoformat()} | ||
370 | + data["deliveryAddress"]["countryName_en"] = translate_country_en(data["deliveryAddress"]["countryName"]) | ||
371 | + data["deliveryAddress"]["countryName_ru"] = translate_country_ru(data["deliveryAddress"]["countryName"]) | ||
372 | + return munchify(data) | ||
580 | 373 | ||
581 | 374 | ||
582 | def test_invalid_features_data(): | 375 | def test_invalid_features_data(): |
@@ -584,16 +377,16 @@ def test_invalid_features_data(): | @@ -584,16 +377,16 @@ def test_invalid_features_data(): | ||
584 | { | 377 | { |
585 | "code": "ee3e24bc17234a41bd3e3a04cc28e9c6", | 378 | "code": "ee3e24bc17234a41bd3e3a04cc28e9c6", |
586 | "featureOf": "tenderer", | 379 | "featureOf": "tenderer", |
587 | - "title": "Термін оплати", | ||
588 | - "description": "Умови відстрочки платежу після поставки товару", | 380 | + "title": fake.title(), |
381 | + "description": fake.description(), | ||
589 | "enum": [ | 382 | "enum": [ |
590 | { | 383 | { |
591 | "value": 0.35, | 384 | "value": 0.35, |
592 | - "title": "180 днів та більше" | 385 | + "title": fake.word() |
593 | }, | 386 | }, |
594 | { | 387 | { |
595 | "value": 0, | 388 | "value": 0, |
596 | - "title": "Менше 30 днів" | 389 | + "title": fake.word() |
597 | } | 390 | } |
598 | ] | 391 | ] |
599 | }, | 392 | }, |
@@ -601,16 +394,16 @@ def test_invalid_features_data(): | @@ -601,16 +394,16 @@ def test_invalid_features_data(): | ||
601 | "code": "48cfd91612c04125ab406374d7cc8d93", | 394 | "code": "48cfd91612c04125ab406374d7cc8d93", |
602 | "featureOf": "item", | 395 | "featureOf": "item", |
603 | "relatedItem": "edd0032574bf4402877ad5f362df225a", | 396 | "relatedItem": "edd0032574bf4402877ad5f362df225a", |
604 | - "title": "Сорт", | ||
605 | - "description": "Сорт продукції", | 397 | + "title": fake.title(), |
398 | + "description": fake.description(), | ||
606 | "enum": [ | 399 | "enum": [ |
607 | { | 400 | { |
608 | "value": 0.35, | 401 | "value": 0.35, |
609 | - "title": "Вищий" | 402 | + "title": fake.word() |
610 | }, | 403 | }, |
611 | { | 404 | { |
612 | "value": 0, | 405 | "value": 0, |
613 | - "title": "Другий" | 406 | + "title": fake.word() |
614 | } | 407 | } |
615 | ] | 408 | ] |
616 | } | 409 | } |
@@ -618,18 +411,19 @@ def test_invalid_features_data(): | @@ -618,18 +411,19 @@ def test_invalid_features_data(): | ||
618 | 411 | ||
619 | 412 | ||
620 | def test_lot_data(): | 413 | def test_lot_data(): |
414 | + value_amount = round(random.uniform(3000, 250000000000), 2) #max value equals to budget of Ukraine in hryvnias | ||
621 | return munchify( | 415 | return munchify( |
622 | { | 416 | { |
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)), | 417 | + "description": fake.description(), |
418 | + "title": field_with_id('l', fake.title()), | ||
625 | "value": { | 419 | "value": { |
626 | "currency": "UAH", | 420 | "currency": "UAH", |
627 | - "amount": 2000 + fake.pyfloat(left_digits=4, right_digits=1, positive=True), | 421 | + "amount": value_amount, |
628 | "valueAddedTaxIncluded": True | 422 | "valueAddedTaxIncluded": True |
629 | }, | 423 | }, |
630 | "minimalStep": { | 424 | "minimalStep": { |
631 | "currency": "UAH", | 425 | "currency": "UAH", |
632 | - "amount": 30.0, | 426 | + "amount": round(random.uniform(0.005, 0.03) * value_amount, 2), |
633 | "valueAddedTaxIncluded": True | 427 | "valueAddedTaxIncluded": True |
634 | }, | 428 | }, |
635 | "status": "active" | 429 | "status": "active" |
@@ -20,15 +20,12 @@ from math import radians, cos, sin, asin, sqrt | @@ -20,15 +20,12 @@ from math import radians, cos, sin, asin, sqrt | ||
20 | from .initial_data import ( | 20 | from .initial_data import ( |
21 | create_fake_doc, | 21 | create_fake_doc, |
22 | create_fake_sentence, | 22 | create_fake_sentence, |
23 | - test_award_data, | ||
24 | test_bid_data, | 23 | test_bid_data, |
25 | test_cancel_claim_data, | 24 | test_cancel_claim_data, |
26 | test_cancel_tender_data, | 25 | test_cancel_tender_data, |
27 | - test_change_cancellation_document_field_data, | ||
28 | test_claim_answer_data, | 26 | test_claim_answer_data, |
29 | test_claim_answer_satisfying_data, | 27 | test_claim_answer_satisfying_data, |
30 | test_claim_data, | 28 | test_claim_data, |
31 | - test_complaint_answer_data, | ||
32 | test_complaint_data, | 29 | test_complaint_data, |
33 | test_complaint_reply_data, | 30 | test_complaint_reply_data, |
34 | test_confirm_data, | 31 | test_confirm_data, |
Please
register
or
login
to post a comment