Skip to content

Commit

Permalink
Merge branch 'a158916227407145_Administrator_award_complaintPeriod'
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Jul 28, 2016
2 parents 9421daa + 2665f52 commit b215f2a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions openprocurement/tender/openua/tests/award.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,22 @@ def test_get_tender_award(self):
u'url', u'name': u'tender_id'}
])

def test_patch_tender_award_Administrator_change(self):
self.app.authorization = ('Basic', ('token', ''))
response = self.app.post_json('/tenders/{}/awards'.format(
self.tender_id), {'data': {'suppliers': [test_organization], 'status': 'pending', 'bid_id': self.initial_bids[0]['id']}})
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
award = response.json['data']
complaintPeriod = award['complaintPeriod'][u'startDate']

self.app.authorization = ('Basic', ('administrator', ''))
response = self.app.patch_json('/tenders/{}/awards/{}'.format(self.tender_id, award['id']), {"data": {"complaintPeriod": {"endDate": award['complaintPeriod'][u'startDate']}}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertIn("endDate", response.json['data']['complaintPeriod'])
self.assertEqual(response.json['data']['complaintPeriod']["endDate"], complaintPeriod)


class TenderLotAwardResourceTest(BaseTenderUAContentWebTest):
initial_status = 'active.qualification'
Expand Down
2 changes: 1 addition & 1 deletion openprocurement/tender/openua/views/award.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def patch(self):
if i.awardID in cancelled_awards:
i.status = 'cancelled'
add_next_award(self.request)
elif not(award_status == 'pending' and award.status == 'pending'):
elif self.request.authenticated_role != 'Administrator' and not(award_status == 'pending' and award.status == 'pending'):
self.request.errors.add('body', 'data', 'Can\'t update award in current ({}) status'.format(award_status))
self.request.errors.status = 403
return
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os

version = '2.3.6'
version = '2.3.7'

requires = [
'setuptools',
Expand Down

0 comments on commit b215f2a

Please sign in to comment.