Skip to content

Commit

Permalink
Merge branch 'master' of github.com:openprocurement/openprocurement.t…
Browse files Browse the repository at this point in the history
…ender.openua
  • Loading branch information
sorenabell committed Mar 23, 2016
2 parents 02c85d8 + 6a5f367 commit 584ff97
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
7 changes: 4 additions & 3 deletions openprocurement/tender/openua/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ def get_role(self):
class Award(BaseAward):
class Options:
roles = {
'edit': whitelist('status', 'qualified', 'eligible'),
'edit': whitelist('status', 'qualified', 'eligible', 'title', 'title_en', 'title_ru',
'description', 'description_en', 'description_ru'),
}
complaints = ListType(ModelType(Complaint), default=list())
items = ListType(ModelType(Item))
Expand Down Expand Up @@ -448,14 +449,14 @@ def validate_tenderPeriod(self, data, period):
raise ValidationError(u"tenderPeriod should be greater than 15 days")

def initialize(self):
endDate = calculate_business_date(self.tenderPeriod.endDate, -ENQUIRY_PERIOD_TIME)
endDate = calculate_business_date(self.tenderPeriod.endDate, -ENQUIRY_PERIOD_TIME, self)
self.enquiryPeriod = EnquiryPeriod(dict(startDate=self.tenderPeriod.startDate,
endDate=endDate,
clarificationsUntil=calculate_business_date(endDate, ENQUIRY_STAND_STILL_TIME, self, True)))

@serializable(serialized_name="enquiryPeriod", type=ModelType(EnquiryPeriod))
def tender_enquiryPeriod(self):
endDate = calculate_business_date(self.tenderPeriod.endDate, -ENQUIRY_PERIOD_TIME)
endDate = calculate_business_date(self.tenderPeriod.endDate, -ENQUIRY_PERIOD_TIME, self)
return EnquiryPeriod(dict(startDate=self.tenderPeriod.startDate,
endDate=endDate,
clarificationsUntil=calculate_business_date(endDate, ENQUIRY_STAND_STILL_TIME, self, True)))
Expand Down
16 changes: 14 additions & 2 deletions openprocurement/tender/openua/tests/award.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def test_patch_tender_award(self):
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
award = response.json['data']

self.app.authorization = auth
response = self.app.patch_json('/tenders/{}/awards/some_id?acc_token={}'.format(
self.tender_id, self.tender_token), {"data": {"status": "unsuccessful"}}, status=404)
Expand Down Expand Up @@ -456,7 +456,11 @@ def test_patch_tender_award(self):
])

response = self.app.patch_json('/tenders/{}/awards/{}?acc_token={}'.format(
self.tender_id, award['id'], self.tender_token), {"data": {"status": "unsuccessful"}})
self.tender_id, award['id'], self.tender_token), {"data": {"title": "title", "description": "description",
"status": "unsuccessful"}})

self.assertEqual(response.json['data']['title'], 'title')
self.assertEqual(response.json['data']['description'], 'description')
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertIn('Location', response.headers)
Expand All @@ -481,6 +485,14 @@ def test_patch_tender_award(self):
self.assertEqual(response.json['errors'], [
{"location": "body", "name": "qualified", "description": ["This field is required."]}
])
response = self.app.patch_json('/tenders/{}/awards/{}?acc_token={}'.format(self.tender_id, new_award['id'], self.tender_token), {"data": {"title": "title", "description": "description",
"qualified": True, "eligible": True}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data']['qualified'], True)
self.assertEqual(response.json['data']['eligible'], True)
self.assertEqual(response.json['data']['title'], 'title')
self.assertEqual(response.json['data']['description'], 'description')

response = self.app.patch_json('/tenders/{}/awards/{}?acc_token={}'.format(self.tender_id, new_award['id'], self.tender_token), {"data": {"status": "active", "qualified": True, "eligible": True}})
self.assertEqual(response.status, '200 OK')
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 @@ -125,7 +125,7 @@ def patch(self):
if i.awardID in cancelled_awards:
i.status = 'cancelled'
add_next_award(self.request)
else:
elif 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 requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ zope.interface==4.1.1
git+https://github.com/openprocurement/barbecue.git
git+https://github.com/openprocurement/python-json-patch.git
git+https://github.com/openprocurement/rfc6266.git
git+https://github.com/openprocurement/openprocurement.api.git
-e git+https://github.com/openprocurement/openprocurement.api.git@master#egg=openprocurement.api

0 comments on commit 584ff97

Please sign in to comment.