Skip to content

Commit

Permalink
Disable require additionalClassification for classification.id == 999…
Browse files Browse the repository at this point in the history
…99999-9
  • Loading branch information
VDigitall committed Mar 13, 2018
1 parent 3d2ee43 commit 56a9fb3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
6 changes: 3 additions & 3 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 15 additions & 7 deletions openprocurement/tender/openuadefense/tests/tender_blanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"] = 'Не ДКПП'
Expand Down

0 comments on commit 56a9fb3

Please sign in to comment.