Commit 4265be2086bb29b216a89d63a6473cd7fa99c4b6

Authored by AlexDiatlov
1 parent 0063b7c6

generate criteria response data

... ... @@ -14,6 +14,7 @@ from op_faker import OP_Provider
14 14 from .local_time import get_now, TZ
15 15 from datetime import datetime
16 16 import string
  17 +from copy import deepcopy
17 18
18 19 fake_en = Factory.create(locale='en_US')
19 20 fake_ru = Factory.create(locale='ru_RU')
... ... @@ -1255,9 +1256,12 @@ def test_article_17_data():
1255 1256
1256 1257
1257 1258 def test_data_bid_criteria():
1258   - return munchify({
1259   - "data": [{
  1259 + bid = munchify({
  1260 + "data": []
  1261 + })
  1262 + mock = {
1260 1263 "description": "Requirement response description",
  1264 + "value": "true",
1261 1265 "evidences": [
1262 1266 {
1263 1267 "relatedDocument": {
... ... @@ -1273,5 +1277,22 @@ def test_data_bid_criteria():
1273 1277 "title": ""
1274 1278 },
1275 1279 "title": "Requirement response title"
1276   - }]
1277   - })
  1280 + }
  1281 + return bid, mock
  1282 +
  1283 +
  1284 +def test_bid_criteria(tender_data, criteria_len, bid_data, bid_document):
  1285 + bid, mock = test_data_bid_criteria()
  1286 + mock = deepcopy(mock)
  1287 + for criteria in tender_data["data"]['criteria']:
  1288 + if criteria.get('source') == 'tenderer':
  1289 + for requirement in criteria['requirementGroups'][0]['requirements']:
  1290 + mock = deepcopy(mock)
  1291 + mock["requirement"]["id"] = requirement["id"]
  1292 + mock["requirement"]["title"] = requirement["title"]
  1293 + mock["evidences"][0]["relatedDocument"]["id"] = bid_document["data"]["id"]
  1294 + mock["evidences"][0]["relatedDocument"]["title"] = bid_document["data"]["title"]
  1295 + bid.data.append(mock)
  1296 + else:
  1297 + pass
  1298 + return bid
... ...
... ... @@ -91,7 +91,8 @@ from .initial_data import (
91 91 test_24_hours_data,
92 92 test_bid_competitive_data_stage_2,
93 93 test_article_17_data,
94   - test_data_bid_criteria
  94 + test_data_bid_criteria,
  95 + test_bid_criteria
95 96 )
96 97 from barbecue import chef
97 98 from restkit import request
... ...
Please register or login to post a comment