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 Nov 16, 2017
1 parent c4aeb29 commit b9fa4f0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openprocurement/tender/esco/tests/tender.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
tender_fundingKind_default,
items_without_deliveryDate_quantity,
tender_noticePublicationDate,
validate_items,
# TestTenderEU
create_tender_invalid,
patch_tender,
Expand All @@ -65,6 +66,7 @@ class TenderESCOTest(BaseESCOWebTest):
test_items_without_deliveryDate_quantity = snitch(items_without_deliveryDate_quantity)
test_tender_fundingKind_default = snitch(tender_fundingKind_default)
test_tender_noticePublicationDate = snitch(tender_noticePublicationDate)
test_validate_items = snitch(validate_items)


class TestTenderEU(BaseESCOContentWebTest, TenderResourceTestMixin, TenderUAResourceTestMixin):
Expand Down
15 changes: 15 additions & 0 deletions openprocurement/tender/esco/tests/tender_blanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1301,3 +1301,18 @@ def create_tender_generated(self):
self.assertNotEqual(data['id'], tender['id'])
self.assertNotEqual(data['doc_id'], tender['id'])
self.assertNotEqual(data['tenderID'], tender['tenderID'])

def validate_items(self):
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 b9fa4f0

Please sign in to comment.