Commit e5f5e14ffc237ebf20f7e00436d8ccd43ccbddff

Authored by AlexDiatlov
1 parent 62c1946a

generate test data for guarantee criteria/response

... ... @@ -189,10 +189,6 @@ def test_tender_data(params,
189 189 "currency": u"UAH",
190 190 "valueAddedTaxIncluded": vat_included
191 191 },
192   - "guarantee": {
193   - "amount": value_amount * 0.75,
194   - "currency": u"UAH",
195   - },
196 192 "minimalStep": {
197 193 "amount": round(random.uniform(0.005, 0.03) * value_amount, 2),
198 194 "currency": u"UAH",
... ... @@ -201,6 +197,9 @@ def test_tender_data(params,
201 197 "items": [],
202 198 "features": []
203 199 }
  200 + if params.get("mode") in ["belowThreshold", "aboveThresholdUA", "aboveThresholdEU", "esco"]:
  201 + data["guarantee"]["amount"] = value_amount * 0.75
  202 + data["guarantee"]["currency"] = u"UAH"
204 203 if params.get("mode") == "open_framework":
205 204 data["mainProcurementCategory"] = random.choice(['goods', 'services'])
206 205 elif params.get("mode") == "open_competitive_dialogue":
... ... @@ -1270,6 +1269,13 @@ def test_article_17_data():
1270 1269 })
1271 1270
1272 1271
  1272 +def test_criteria_guarantee_data():
  1273 + criteria = fake.criteria_bid_contract_guarantee()
  1274 + return munchify({
  1275 + "data": criteria
  1276 + })
  1277 +
  1278 +
1273 1279 def test_data_bid_criteria():
1274 1280 bid = munchify({
1275 1281 "data": []
... ... @@ -1302,20 +1308,20 @@ def test_bid_criteria(tender_data, criteria_len, bid_data, bid_document):
1302 1308 for criteria in tender_data["data"]['criteria']:
1303 1309 if criteria.get('source') == 'tenderer':
1304 1310 for requirement in criteria['requirementGroups'][0]['requirements']:
1305   - mock = deepcopy(mock)
1306   - mock["requirement"]["id"] = requirement["id"]
1307   - mock["requirement"]["title"] = requirement["title"]
  1311 + mock_tenderer = deepcopy(mock)
  1312 + mock_tenderer["requirement"]["id"] = requirement["id"]
  1313 + mock_tenderer["requirement"]["title"] = requirement["title"]
  1314 + mock_tenderer["evidences"][0]["relatedDocument"]["id"] = bid_document["data"]["id"]
  1315 + mock_tenderer["evidences"][0]["relatedDocument"]["title"] = bid_document["data"]["title"]
1308 1316 if criteria.get('title') == u'Мова (мови), якою (якими) повинні готуватися тендерні пропозиції':
1309   - del mock["evidences"][0]
1310   - else:
1311   - mock["evidences"][0]["relatedDocument"]["id"] = bid_document["data"]["id"]
1312   - mock["evidences"][0]["relatedDocument"]["title"] = bid_document["data"]["title"]
1313   - bid.data.append(mock)
  1317 + del mock_tenderer["evidences"][0]
  1318 + bid.data.append(mock_tenderer)
1314 1319 elif criteria.get('source') == 'winner':
1315 1320 for requirement in criteria['requirementGroups'][0]['requirements']:
1316 1321 mock = deepcopy(mock)
1317 1322 mock["requirement"]["id"] = requirement["id"]
1318 1323 mock["requirement"]["title"] = requirement["title"]
  1324 + del mock["evidences"][0]
1319 1325 bid.data.append(mock)
1320 1326 else:
1321 1327 pass
... ...
... ... @@ -40,6 +40,7 @@ class OP_Provider(BaseProvider):
40 40 profiles_shortlistedfirms_empty = _fake_data.profiles_shortlistedfirms_empty
41 41 unknown_profile = _fake_data.unknown_profiles
42 42 criteria = _fake_data.criteria
  43 + criteria_guarant = _fake_data.criteria_guarantee
43 44
44 45 @classmethod
45 46 def randomize_nb_elements(self, number=10, le=60, ge=140):
... ... @@ -259,3 +260,7 @@ class OP_Provider(BaseProvider):
259 260 @classmethod
260 261 def criteria_article_17(self):
261 262 return deepcopy(self.criteria)
  263 +
  264 + @classmethod
  265 + def criteria_bid_contract_guarantee(self):
  266 + return deepcopy(self.criteria_guarant)
... ...
... ... @@ -96,7 +96,8 @@ from .initial_data import (
96 96 test_qualification_criteria,
97 97 test_awards_criteria,
98 98 test_tender_data_simple_defense,
99   - test_contract_criteria_response_data
  99 + test_contract_criteria_response_data,
  100 + test_criteria_guarantee_data
100 101 )
101 102 from barbecue import chef
102 103 from restkit import request
... ...
Please register or login to post a comment