Commit 0dff02e75e354ba48823c50d154a56b3ab00c23b

Authored by AlexDiatlov
1 parent 22c99219

reasonType cancellation

... ... @@ -220,7 +220,7 @@ ${ERROR_PLAN_MESSAGE}= Calling method 'get_plan' failed: ResourceGone: {"status
220 220 ${period_intervals}= compute_intrs ${BROKERS} ${used_brokers}
221 221 ${accelerator}= Get Variable Value ${accelerator}
222 222 ${accelerator}= Set Variable If '${accelerator}' != '${None}' ${accelerator} ${period_intervals.default.accelerator}
223   - ${monitoring_data}= tets_monitoring_data ${USERS.users['${dasu_user}'].tender_data.data.id} ${accelerator}
  223 + ${monitoring_data}= test_monitoring_data ${USERS.users['${dasu_user}'].tender_data.data.id} ${accelerator}
224 224 Log ${monitoring_data}
225 225 ${MNITORING_UAID}= Run As ${dasu_user} Створити об'єкт моніторингу ${monitoring_data}
226 226 ${MONITORING}= Create Dictionary
... ...
... ... @@ -721,12 +721,13 @@ Library openprocurement_client.utils
721 721
722 722
723 723 Скасувати лот
724   - [Arguments] ${username} ${tender_uaid} ${lot_id} ${cancellation_reason} ${document} ${new_description}
  724 + [Arguments] ${username} ${tender_uaid} ${lot_id} ${cancellation_reason} ${cancellation_reasonType} ${document} ${new_description}
725 725 ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid}
726 726 ${lot_index}= get_object_index_by_id ${tender.data.lots} ${lot_id}
727 727 ${lot_id}= Get Variable Value ${tender.data.lots[${lot_index}].id}
728 728 ${data}= Create dictionary
729 729 ... reason=${cancellation_reason}
  730 + ... reasonType=${cancellation_reasonType}
730 731 ... cancellationOf=lot
731 732 ... relatedLot=${lot_id}
732 733 ${cancellation_data}= Create dictionary data=${data}
... ... @@ -1609,9 +1610,11 @@ Library openprocurement_client.utils
1609 1610 ... and call create_cancellation
1610 1611 ... After that add document to cancellation and change description of document
1611 1612 ... [Return] Nothing
1612   - [Arguments] ${username} ${tender_uaid} ${cancellation_reason} ${document} ${new_description}
  1613 + [Arguments] ${username} ${tender_uaid} ${cancellation_reason} ${cancellation_reasonType} ${document} ${new_description}
1613 1614 ${tender}= openprocurement_client.Пошук тендера по ідентифікатору ${username} ${tender_uaid}
1614   - ${data}= Create dictionary reason=${cancellation_reason}
  1615 + ${data}= Create dictionary
  1616 + ... reason=${cancellation_reason}
  1617 + ... reasonType=${cancellation_reasonType}
1615 1618 ${cancellation_data}= Create dictionary data=${data}
1616 1619 ${cancellation_data}= munch_dict arg=${cancellation_data}
1617 1620 ${cancel_reply}= Call Method ${USERS.users['${username}'].client} create_cancellation
... ...
... ... @@ -164,24 +164,26 @@ ${PLAN_TENDER} ${True}
164 164
165 165 *** Keywords ***
166 166 Можливість скасувати тендер
167   - ${cancellation_data}= Підготувати дані про скасування
  167 + ${cancellation_data}= Підготувати дані про скасування ${USERS.users['${tender_owner}'].initial_data.data.procurementMethodType}
168 168 Run As ${tender_owner}
169 169 ... Скасувати закупівлю
170 170 ... ${TENDER['TENDER_UAID']}
171 171 ... ${cancellation_data['cancellation_reason']}
  172 + ... ${cancellation_data['cancellation_reasonType']}
172 173 ... ${cancellation_data['document']['doc_path']}
173 174 ... ${cancellation_data['description']}
174 175 Set To Dictionary ${USERS.users['${tender_owner}']} tender_cancellation_data=${cancellation_data}
175 176
176 177
177 178 Можливість скасувати ${index} лот
178   - ${cancellation_data}= Підготувати дані про скасування
  179 + ${cancellation_data}= Підготувати дані про скасування ${USERS.users['${tender_owner}'].initial_data.data.procurementMethodType}
179 180 ${lot_id}= get_id_from_object ${USERS.users['${tender_owner}'].initial_data.data.lots[${index}]}
180 181 Run As ${tender_owner}
181 182 ... Скасувати лот
182 183 ... ${TENDER['TENDER_UAID']}
183 184 ... ${lot_id}
184 185 ... ${cancellation_data['cancellation_reason']}
  186 + ... ${cancellation_data['cancellation_reasonType']}
185 187 ... ${cancellation_data['document']['doc_path']}
186 188 ... ${cancellation_data['description']}
187 189 Set To Dictionary ${USERS.users['${tender_owner}']} lot_cancellation_data=${cancellation_data}
... ...
... ... @@ -12,19 +12,19 @@ from munch import munchify
12 12 from op_faker import OP_Provider
13 13 from .local_time import get_now, TZ
14 14
15   -
16 15 fake_en = Factory.create(locale='en_US')
17 16 fake_ru = Factory.create(locale='ru_RU')
18 17 fake_uk = Factory.create(locale='uk_UA')
19 18 fake_uk.add_provider(OP_Provider)
20 19 fake = fake_uk
21 20 used_identifier_id = []
22   -mode_open = ["belowThreshold", "aboveThresholdUA", "aboveThresholdEU",
23   - "aboveThresholdUA.defense", "competitiveDialogueUA", "competitiveDialogueEU", "esco", "closeFrameworkAgreementUA"]
24   -mode_limited = ["reporting", "negotiation.quick", "negotiation"]
  21 +mode_open = ["belowThreshold", "aboveThresholdUA", "aboveThresholdEU",
  22 + "aboveThresholdUA.defense", "competitiveDialogueUA", "competitiveDialogueEU", "esco",
  23 + "closeFrameworkAgreementUA"]
  24 +mode_limited = ["reporting", "negotiation.quick", "negotiation"]
25 25 violationType = ["corruptionDescription", "corruptionProcurementMethodType", "corruptionChanges",
26   - "corruptionPublicDisclosure", "corruptionBiddingDocuments", "documentsForm",
27   - "corruptionAwarded", "corruptionCancelled", "corruptionContracting"]
  26 + "corruptionPublicDisclosure", "corruptionBiddingDocuments", "documentsForm",
  27 + "corruptionAwarded", "corruptionCancelled", "corruptionContracting"]
28 28
29 29 # This workaround fixes an error caused by missing "catch_phrase" class method
30 30 # for the "ru_RU" locale in Faker >= 0.7.4
... ... @@ -106,10 +106,10 @@ def create_fake_period(days=0, hours=0, minutes=0):
106 106
107 107
108 108 def subtraction(value1, value2):
109   - if "." in str (value1) or "." in str (value2):
110   - return (float (value1) - float (value2))
  109 + if "." in str(value1) or "." in str(value2):
  110 + return (float(value1) - float(value2))
111 111 else:
112   - return (int (value1) - int (value2))
  112 + return (int(value1) - int(value2))
113 113
114 114
115 115 def create_fake_value_amount():
... ... @@ -132,7 +132,7 @@ def translate_country_en(country):
132 132
133 133
134 134 def convert_amount(amount):
135   - return (("{:,}".format(float (amount))).replace(',',' ').replace('.',','))
  135 + return ("{:,}".format(float(amount))).replace(',', ' ').replace('.', ',')
136 136
137 137
138 138 def translate_country_ru(country):
... ... @@ -201,7 +201,7 @@ def test_tender_data(params,
201 201 accelerator = accelerator \
202 202 if accelerator else params['intervals']['accelerator']
203 203 data['procurementMethodDetails'] = 'quick, ' \
204   - 'accelerator={}'.format(accelerator)
  204 + 'accelerator={}'.format(accelerator)
205 205 data["procuringEntity"]["kind"] = "other"
206 206 if data.get("mode") == "test":
207 207 data["title"] = u"[ТЕСТУВАННЯ] {}".format(data["title"])
... ... @@ -318,7 +318,7 @@ def test_tender_data_planning(params):
318 318 "mode": "test",
319 319 "items": [],
320 320 "buyers": []
321   - }
  321 + }
322 322 data["procuringEntity"]["name"] = data["procuringEntity"]["identifier"]["legalName"]
323 323 buyers = test_buyers_data()
324 324 buyers["name"] = buyers["identifier"]["legalName"]
... ... @@ -345,7 +345,8 @@ def test_tender_data_planning(params):
345 345 item_data = test_item_data(id_cpv)
346 346 del item_data['deliveryAddress']
347 347 del item_data['deliveryLocation']
348   - item_data['deliveryDate']['endDate'] = (get_now() + timedelta(days=10)).replace(hour=0, minute=0, second=0, microsecond=0).isoformat()
  348 + item_data['deliveryDate']['endDate'] = (get_now() + timedelta(days=10)).replace(hour=0, minute=0, second=0,
  349 + microsecond=0).isoformat()
349 350 del item_data['deliveryDate']['startDate']
350 351 data['items'].append(item_data)
351 352 if params['mode'] in mode_open:
... ... @@ -545,12 +546,12 @@ def test_bid_value(max_value_amount, vat_included):
545 546 def test_bid_value_esco(tender_data):
546 547 annual_cost = []
547 548 for i in range(0, 21):
548   - cost=round(random.uniform(1, 100), 2)
  549 + cost = round(random.uniform(1, 100), 2)
549 550 annual_cost.append(cost)
550 551 if tender_data['fundingKind'] == "budget":
551   - yearly_percentage=round(random.uniform(0.01, float(tender_data['yearlyPaymentsPercentageRange'])), 5)
  552 + yearly_percentage = round(random.uniform(0.01, float(tender_data['yearlyPaymentsPercentageRange'])), 5)
552 553 else:
553   - yearly_percentage= 0.8
  554 + yearly_percentage = 0.8
554 555 # when tender fundingKind is budget, yearlyPaymentsPercentageRange should be less or equal 0.8, and more or equal 0
555 556 # when tender fundingKind is other, yearlyPaymentsPercentageRange should be equal 0.8
556 557 return munchify({
... ... @@ -577,7 +578,9 @@ def test_bid_data_selection(data, index):
577 578 })
578 579 bid.data['status'] = 'draft'
579 580 bid.data['parameters'] = data['agreements'][0]['contracts'][index]['parameters']
580   - bid.data['lotValues'] = [test_bid_value(data['agreements'][0]['contracts'][index]['value']['amount'], data['agreements'][0]['contracts'][index]['value']['valueAddedTaxIncluded'])]
  581 + bid.data['lotValues'] = [test_bid_value(data['agreements'][0]['contracts'][index]['value']['amount'],
  582 + data['agreements'][0]['contracts'][index]['value'][
  583 + 'valueAddedTaxIncluded'])]
581 584 return bid
582 585
583 586
... ... @@ -605,8 +608,10 @@ def test_item_data(cpv=None):
605 608 startDate = fake.random_int(min=1, max=30)
606 609 endDate = startDate + fake.random_int(min=1, max=7)
607 610 data["deliveryDate"] = {
608   - "startDate": (get_now() + timedelta(days=startDate)).astimezone(TZ).replace(hour=0, minute=0, second=0, microsecond=0).isoformat(),
609   - "endDate": (get_now() + timedelta(days=endDate)).astimezone(TZ).replace(hour=0, minute=0, second=0, microsecond=0).isoformat()
  611 + "startDate": (get_now() + timedelta(days=startDate)).astimezone(TZ).replace(hour=0, minute=0, second=0,
  612 + microsecond=0).isoformat(),
  613 + "endDate": (get_now() + timedelta(days=endDate)).astimezone(TZ).replace(hour=0, minute=0, second=0,
  614 + microsecond=0).isoformat()
610 615 }
611 616 data["deliveryAddress"]["countryName_en"] = translate_country_en(data["deliveryAddress"]["countryName"])
612 617 data["deliveryAddress"]["countryName_ru"] = translate_country_ru(data["deliveryAddress"]["countryName"])
... ... @@ -698,7 +703,8 @@ def test_tender_data_openeu(params, submissionMethodDetails, plan_data):
698 703 data['procuringEntity']['name_en'] = fake_en.name()
699 704 data['procuringEntity']['contactPoint']['name_en'] = fake_en.name()
700 705 data['procuringEntity']['contactPoint']['availableLanguage'] = "en"
701   - data['procuringEntity']['identifier']['legalName_en'] = u"Institution \"Vinnytsia City Council primary and secondary general school № 10\""
  706 + data['procuringEntity']['identifier'][
  707 + 'legalName_en'] = u"Institution \"Vinnytsia City Council primary and secondary general school № 10\""
702 708 data['procuringEntity']['kind'] = 'general'
703 709 return data
704 710
... ... @@ -748,34 +754,34 @@ def test_tender_data_selection(procedure_intervals, params, submissionMethodDeta
748 754 data['agreements'] = [{'id': tender_data['data']['agreements'][0]['id']}]
749 755 del data['value']
750 756 del data['minimalStep']
751   - return munchify({'data':data})
  757 + return munchify({'data': data})
752 758
753 759
754 760 def test_change_data():
755 761 return munchify(
756   - {
757   - "data":
758 762 {
759   - "rationale": fake.description(),
760   - "rationale_en": fake_en.sentence(nb_words=10, variable_nb_words=True),
761   - "rationale_ru": fake_ru.sentence(nb_words=10, variable_nb_words=True),
762   - "rationaleTypes": fake.rationaleTypes(amount=3),
763   - "status": "pending"
764   - }
765   - })
  763 + "data":
  764 + {
  765 + "rationale": fake.description(),
  766 + "rationale_en": fake_en.sentence(nb_words=10, variable_nb_words=True),
  767 + "rationale_ru": fake_ru.sentence(nb_words=10, variable_nb_words=True),
  768 + "rationaleTypes": fake.rationaleTypes(amount=3),
  769 + "status": "pending"
  770 + }
  771 + })
766 772
767 773
768 774 def test_agreement_change_data(rationaleType):
769 775 return munchify(
770   - {
771   - "data":
772 776 {
773   - "rationale": fake.description(),
774   - "rationale_en": fake_en.sentence(nb_words=10, variable_nb_words=True),
775   - "rationale_ru": fake_ru.sentence(nb_words=10, variable_nb_words=True),
776   - "rationaleType": rationaleType,
777   - }
778   - })
  777 + "data":
  778 + {
  779 + "rationale": fake.description(),
  780 + "rationale_en": fake_en.sentence(nb_words=10, variable_nb_words=True),
  781 + "rationale_ru": fake_ru.sentence(nb_words=10, variable_nb_words=True),
  782 + "rationaleType": rationaleType,
  783 + }
  784 + })
779 785
780 786
781 787 def test_modification_data(item_id, field_name, field_value):
... ... @@ -787,24 +793,21 @@ def test_modification_data(item_id, field_name, field_value):
787 793 }
788 794 ]
789 795 }
790   - return munchify({'data':data})
  796 + return munchify({'data': data})
791 797
792 798
793 799 def get_hash(file_contents):
794   - return ("md5:"+hashlib.md5(file_contents).hexdigest())
  800 + return ("md5:" + hashlib.md5(file_contents).hexdigest())
795 801
796 802
797   -def tets_monitoring_data( tender_id, accelerator=None):
798   - data = {
799   - "reasons": [random.choice(["public", "fiscal", "indicator", "authorities", "media"])],
800   - "tender_id": tender_id,
801   - "procuringStages": [random.choice(["awarding", "contracting", "planning"])],
802   - "parties": [test_party()],
803   - "mode": "test"
804   - }
805   - data['monitoringDetails'] = 'quick, ' \
806   - 'accelerator={}'.format(accelerator)
807   - return munchify({'data':data})
  803 +def test_monitoring_data(tender_id, accelerator=None):
  804 + data = {"reasons": [random.choice(["public", "fiscal", "indicator", "authorities", "media"])],
  805 + "tender_id": tender_id,
  806 + "procuringStages": [random.choice(["awarding", "contracting", "planning"])],
  807 + "parties": [test_party()],
  808 + "mode": "test",
  809 + 'monitoringDetails': 'quick, ' 'accelerator={}'.format(accelerator)}
  810 + return munchify({'data': data})
808 811
809 812
810 813 def test_party():
... ... @@ -816,26 +819,26 @@ def test_party():
816 819
817 820 def test_dialogue():
818 821 return munchify(
819   - {
820   - "data":
821 822 {
822   - "title": fake_en.sentence(nb_words=10, variable_nb_words=True),
823   - "description": fake_en.sentence(nb_words=10, variable_nb_words=True)
824   - }
825   - })
  823 + "data":
  824 + {
  825 + "title": fake_en.sentence(nb_words=10, variable_nb_words=True),
  826 + "description": fake_en.sentence(nb_words=10, variable_nb_words=True)
  827 + }
  828 + })
826 829
827 830
828 831 def test_conclusion(violationOccurred, relatedParty_id):
829 832 return munchify(
830   - {
831   - "data": {
832   - "conclusion": {
833   - "violationOccurred": violationOccurred,
834   - "violationType": random.choice(violationType),
835   - "relatedParty": relatedParty_id,
  833 + {
  834 + "data": {
  835 + "conclusion": {
  836 + "violationOccurred": violationOccurred,
  837 + "violationType": random.choice(violationType),
  838 + "relatedParty": relatedParty_id,
  839 + }
836 840 }
837   - }
838   - })
  841 + })
839 842
840 843
841 844 def test_status_data(status, relatedParty_id=None):
... ... @@ -890,7 +893,7 @@ def test_tender_data_esco(params, submissionMethodDetails, plan_data):
890 893 if index == 0:
891 894 data['lots'][index]['minimalStepPercentage'] = data['minimalStepPercentage']
892 895 else:
893   - data['lots'][index]['minimalStepPercentage'] = round((float(data['minimalStepPercentage'])-0.0002), 5)
  896 + data['lots'][index]['minimalStepPercentage'] = round((float(data['minimalStepPercentage']) - 0.0002), 5)
894 897 if data['fundingKind'] == "budget":
895 898 data['lots'][index]['yearlyPaymentsPercentageRange'] = float(round(random.uniform(0.01, 0.8), 5))
896 899 else:
... ... @@ -932,25 +935,25 @@ def percentage_generation(number_of_milestones):
932 935
933 936 def invalid_INN_data():
934 937 return munchify({
935   - "scheme": "INN",
936   - "description": "Insulin (human)",
937   - "id": "insulin (human)"
  938 + "scheme": "INN",
  939 + "description": "Insulin (human)",
  940 + "id": "insulin (human)"
938 941 })
939 942
940 943
941 944 def invalid_cost_data():
942 945 return munchify({
943   - "scheme": "UA-ROAD",
944   - "id": "H-08",
945   - "description": "Бориспіль - Дніпро - Запоріжжя (через м. Кременчук) - Маріуполь"
  946 + "scheme": "UA-ROAD",
  947 + "id": "H-08",
  948 + "description": "Бориспіль - Дніпро - Запоріжжя (через м. Кременчук) - Маріуполь"
946 949 })
947 950
948 951
949 952 def invalid_gmdn_data():
950 953 return munchify({
951   - "scheme": "GMDN",
952   - "id": "10082",
953   - "description": "Змішувач амальгами для стоматології"
  954 + "scheme": "GMDN",
  955 + "id": "10082",
  956 + "description": "Змішувач амальгами для стоматології"
954 957 })
955 958
956 959
... ... @@ -973,7 +976,7 @@ def invalid_buyers_data():
973 976 "legalName": "Київський Тестовий Ліцей",
974 977 },
975 978 "name": "Київський Тестовий Ліцей"
976   - }
  979 + }
977 980 return munchify(buyers)
978 981
979 982
... ... @@ -1011,3 +1014,15 @@ def breakdown_value_generation(number_of_breakdown, plan_value):
1011 1014 value_data = [round(random.uniform(1, plan_value / number_of_breakdown), 2) for _ in range(number_of_breakdown - 1)]
1012 1015 value_data.append(round(plan_value - sum(value_data), 2))
1013 1016 return value_data
  1017 +
  1018 +
  1019 +def test_cancellation_data(procurement_method_type):
  1020 + if procurement_method_type == "aboveThresholdUA.defense":
  1021 + result = random.choice(["noDemand", "unFixable", "expensesCut"])
  1022 + elif procurement_method_type in ["negotiation", "negotiation.quick"]:
  1023 + result = random.choice(["noObjectiveness", "unFixable", "noDemand", "expensesCut", "dateViolation"])
  1024 + elif procurement_method_type == "belowThreshold":
  1025 + result = random.choice(["noDemand", "unFixable", "expensesCut"])
  1026 + else:
  1027 + result = random.choice(["noDemand", "unFixable", "forceMajeure", "expensesCut"])
  1028 + return munchify({"reasonType": result})
... ...
... ... @@ -342,6 +342,8 @@ Get Broker Property By Username
342 342
343 343
344 344 Підготувати дані про скасування
  345 + [Arguments] ${procurementMethodType}
  346 + ${cancellation_data}= test_cancellation_data ${procurementMethodType}
345 347 ${cancellation_reason}= create_fake_sentence
346 348 ${cancellation_reason}= field_with_id c ${cancellation_reason}
347 349 ${cancellation_id}= get_id_from_string ${cancellation_reason}
... ... @@ -355,6 +357,7 @@ Get Broker Property By Username
355 357 ${new_description}= create_fake_sentence
356 358 ${cancellation_data}= Create Dictionary
357 359 ... cancellation_reason=${cancellation_reason}
  360 + ... cancellation_reasonType=${cancellation_data.reasonType}
358 361 ... cancellation_id=${cancellation_id}
359 362 ... document=${document}
360 363 ... description=${new_description}
... ...
... ... @@ -60,7 +60,7 @@ from .initial_data import (
60 60 test_tender_data_framework_agreement,
61 61 test_tender_data_selection,
62 62 test_bid_competitive_data,
63   - tets_monitoring_data,
  63 + test_monitoring_data,
64 64 test_party,
65 65 test_dialogue,
66 66 test_conclusion,
... ... @@ -80,7 +80,8 @@ from .initial_data import (
80 80 invalid_gmdn_data,
81 81 invalid_buyers_data,
82 82 test_plan_cancel_data,
83   - test_confirm_plan_cancel_data
  83 + test_confirm_plan_cancel_data,
  84 + test_cancellation_data
84 85 )
85 86 from barbecue import chef
86 87 from restkit import request
... ...
Please register or login to post a comment