Skip to content

Commit

Permalink
add validate_items test
Browse files Browse the repository at this point in the history
  • Loading branch information
vladkhard committed Sep 18, 2017
1 parent bacd077 commit 519a267
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions openprocurement/tender/esco/tests/tender.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
tender_min_value,
tender_minimal_step_invalid,
tender_yearlyPaymentsPercentageRange_invalid,
validate_items,
#TestTenderEU
create_tender_invalid,
patch_tender,
Expand Down
21 changes: 21 additions & 0 deletions openprocurement/tender/esco/tests/tender_blanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,3 +732,24 @@ def tender_submission_method_details_no_auction_only(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data']['submissionMethodDetails'], "quick(mode:no-auction)")

def validate_items(self):
data = deepcopy(self.initial_data)
response = self.app.post_json("/tenders", {"data": data}, status=201)

self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')

data = deepcopy(self.initial_data)
data["items"][0]["classification"]["id"] = u"92332000-7"
data["items"].append(deepcopy(data["items"][0]))
data["items"][1]["classification"]["id"] = u"92340000-6"
response = self.app.post_json("/tenders", {"data": data}, status=422)

self.assertEqual(response.status, '422 Unprocessable Entity')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'], [
{u'description': [u'CPV class of items should be identical'],
u'location': u'body',
u'name': u'items'}
])

0 comments on commit 519a267

Please sign in to comment.