From 56a9fb3908edfd489457a321d1540758f9125380 Mon Sep 17 00:00:00 2001 From: VDigitall Date: Tue, 13 Mar 2018 08:36:06 +0200 Subject: [PATCH] Disable require additionalClassification for classification.id == 99999999-9 --- buildout.cfg | 6 ++--- .../openuadefense/tests/tender_blanks.py | 22 +++++++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/buildout.cfg b/buildout.cfg index 6ae84a1..85dd386 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -10,9 +10,9 @@ index = https://pypi.python.org/simple [sources] openprocurement.api = git https://github.com/openprocurement/openprocurement.api.git branch=production -openprocurement.tender.core = git https://github.com/openprocurement/openprocurement.tender.core.git branch=production -openprocurement.tender.belowthreshold = git https://github.com/openprocurement/openprocurement.tender.belowthreshold.git branch=production -openprocurement.tender.openua = git https://github.com/openprocurement/openprocurement.tender.openua.git branch=production +openprocurement.tender.core = git https://github.com/openprocurement/openprocurement.tender.core.git branch=a563879808284502_disable_999999-9_additional_classification_required +openprocurement.tender.belowthreshold = git https://github.com/openprocurement/openprocurement.tender.belowthreshold.git branch=a563879808284502_disable_999999-9_additional_classification_required +openprocurement.tender.openua = git https://github.com/openprocurement/openprocurement.tender.openua.git branch=a563879808284502_disable_999999-9_additional_classification_required [test] recipe = zc.recipe.egg:scripts diff --git a/openprocurement/tender/openuadefense/tests/tender_blanks.py b/openprocurement/tender/openuadefense/tests/tender_blanks.py index 1eebf1a..c87044f 100644 --- a/openprocurement/tender/openuadefense/tests/tender_blanks.py +++ b/openprocurement/tender/openuadefense/tests/tender_blanks.py @@ -4,6 +4,9 @@ from openprocurement.tender.belowthreshold.tests.base import test_organization +from openprocurement.tender.core.constants import ( + NOT_REQUIRED_ADDITIONAL_CLASSIFICATION_FROM +) from openprocurement.tender.core.models import get_now, CPV_ITEMS_CLASS_FROM from openprocurement.tender.openuadefense.models import Tender @@ -222,16 +225,21 @@ def create_tender_invalid(self): if get_now() > CPV_ITEMS_CLASS_FROM: cpv_code = self.initial_data["items"][0]['classification']['id'] self.initial_data["items"][0]['classification']['id'] = '99999999-9' - response = self.app.post_json(request_path, {'data': self.initial_data}, status=422) + status = 422 if get_now() < NOT_REQUIRED_ADDITIONAL_CLASSIFICATION_FROM else 201 + response = self.app.post_json(request_path, {'data': self.initial_data}, status=status) self.initial_data["items"][0]["additionalClassifications"] = data if get_now() > CPV_ITEMS_CLASS_FROM: self.initial_data["items"][0]['classification']['id'] = cpv_code - self.assertEqual(response.status, '422 Unprocessable Entity') - self.assertEqual(response.content_type, 'application/json') - self.assertEqual(response.json['status'], 'error') - self.assertEqual(response.json['errors'], [ - {u'description': [{u'additionalClassifications': [u'This field is required.']}], u'location': u'body', u'name': u'items'} - ]) + if status == 201: + self.assertEqual(response.status, '201 Created') + self.assertEqual(response.content_type, 'application/json') + else: + self.assertEqual(response.status, '422 Unprocessable Entity') + self.assertEqual(response.content_type, 'application/json') + self.assertEqual(response.json['status'], 'error') + self.assertEqual(response.json['errors'], [ + {u'description': [{u'additionalClassifications': [u'This field is required.']}], u'location': u'body', u'name': u'items'} + ]) data = self.initial_data["items"][0]["additionalClassifications"][0]["scheme"] self.initial_data["items"][0]["additionalClassifications"][0]["scheme"] = 'Не ДКПП'