From c9e6fc4eec98d7ba4f6404a6a69fb188b2ef316a Mon Sep 17 00:00:00 2001 From: vladkhard Date: Mon, 2 Oct 2017 18:52:50 +0300 Subject: [PATCH] add validate_items test --- openprocurement/tender/esco/tests/tender.py | 2 ++ .../tender/esco/tests/tender_blanks.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/openprocurement/tender/esco/tests/tender.py b/openprocurement/tender/esco/tests/tender.py index 548fed9..162c2d2 100644 --- a/openprocurement/tender/esco/tests/tender.py +++ b/openprocurement/tender/esco/tests/tender.py @@ -39,6 +39,7 @@ tender_fundingKind_default, items_without_deliveryDate_quantity, tender_noticePublicationDate, + validate_items, #TestTenderEU create_tender_invalid, patch_tender, @@ -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): diff --git a/openprocurement/tender/esco/tests/tender_blanks.py b/openprocurement/tender/esco/tests/tender_blanks.py index 6bd5b40..51e758e 100644 --- a/openprocurement/tender/esco/tests/tender_blanks.py +++ b/openprocurement/tender/esco/tests/tender_blanks.py @@ -1244,3 +1244,19 @@ 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) + 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'} +])