Commit 4265be2086bb29b216a89d63a6473cd7fa99c4b6

Authored by AlexDiatlov
1 parent 0063b7c6

generate criteria response data

@@ -14,6 +14,7 @@ from op_faker import OP_Provider @@ -14,6 +14,7 @@ from op_faker import OP_Provider
14 from .local_time import get_now, TZ 14 from .local_time import get_now, TZ
15 from datetime import datetime 15 from datetime import datetime
16 import string 16 import string
  17 +from copy import deepcopy
17 18
18 fake_en = Factory.create(locale='en_US') 19 fake_en = Factory.create(locale='en_US')
19 fake_ru = Factory.create(locale='ru_RU') 20 fake_ru = Factory.create(locale='ru_RU')
@@ -1255,9 +1256,12 @@ def test_article_17_data(): @@ -1255,9 +1256,12 @@ def test_article_17_data():
1255 1256
1256 1257
1257 def test_data_bid_criteria(): 1258 def test_data_bid_criteria():
1258 - return munchify({  
1259 - "data": [{ 1259 + bid = munchify({
  1260 + "data": []
  1261 + })
  1262 + mock = {
1260 "description": "Requirement response description", 1263 "description": "Requirement response description",
  1264 + "value": "true",
1261 "evidences": [ 1265 "evidences": [
1262 { 1266 {
1263 "relatedDocument": { 1267 "relatedDocument": {
@@ -1273,5 +1277,22 @@ def test_data_bid_criteria(): @@ -1273,5 +1277,22 @@ def test_data_bid_criteria():
1273 "title": "" 1277 "title": ""
1274 }, 1278 },
1275 "title": "Requirement response title" 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,7 +91,8 @@ from .initial_data import (
91 test_24_hours_data, 91 test_24_hours_data,
92 test_bid_competitive_data_stage_2, 92 test_bid_competitive_data_stage_2,
93 test_article_17_data, 93 test_article_17_data,
94 - test_data_bid_criteria 94 + test_data_bid_criteria,
  95 + test_bid_criteria
95 ) 96 )
96 from barbecue import chef 97 from barbecue import chef
97 from restkit import request 98 from restkit import request
Please register or login to post a comment