Skip to content

Commit

Permalink
Merge a563879808284502_disable_999999-9_additional_classification_req…
Browse files Browse the repository at this point in the history
…uired into master
  • Loading branch information
VDigitall committed Mar 19, 2018
2 parents 8cac8e8 + 46bc7db commit 822fbdc
Showing 1 changed file with 15 additions and 7 deletions.
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 822fbdc

Please sign in to comment.