Skip to content

Commit

Permalink
Add test for tenderPeriod
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-shchudlo committed Sep 19, 2017
1 parent bd3c770 commit 13589c3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions openprocurement/tender/esco/tests/tender_blanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,22 @@ def create_tender_invalid(self):
{u'description': [u'tenderPeriod.startDate should be in greater than current date'], u'location': u'body', u'name': u'tenderPeriod'}
])

response = self.app.post_json('/tenders', {'data': self.initial_data})
self.assertEqual(response.status, '201 Created')
tender = response.json['data']
self.tender_id = response.json['data']['id']
owner_token = response.json['access']['token']
now = get_now()
response = self.app.patch_json('/tenders/{}?acc_token={}'.format(
tender['id'], owner_token), {'data': {'tenderPeriod': {'startDate': now.isoformat(),
'endDate': now.isoformat()}}}, status=422)
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'tenderPeriod should be greater than 30 days'], u'location': u'body',
u'name': u'tenderPeriod'}])

now = get_now()
self.initial_data['awardPeriod'] = {'startDate': now.isoformat(), 'endDate': now.isoformat()}
response = self.app.post_json(request_path, {'data': self.initial_data}, status=422)
Expand Down

0 comments on commit 13589c3

Please sign in to comment.