Skip to content

Commit

Permalink
Added default values for fields
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Jan 15, 2015
1 parent 0902558 commit 3424afa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/openprocurement/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ class Options:


plain_role = (blacklist('_attachments', 'revisions', 'dateModified') + schematics_embedded_role)
create_role = (blacklist('owner_token', 'owner', '_attachments', 'revisions', 'dateModified', 'doc_id', 'tenderID', 'bids', 'documents', 'awards', 'questions', 'complaints', 'auctionUrl', 'status', 'auctionPeriod', 'awardPeriod') + schematics_embedded_role)
edit_role = (blacklist('owner_token', 'owner', '_attachments', 'revisions', 'dateModified', 'doc_id', 'tenderID', 'bids', 'documents', 'awards', 'questions', 'complaints', 'auctionUrl', 'auctionPeriod', 'awardPeriod') + schematics_embedded_role)
create_role = (blacklist('owner_token', 'owner', '_attachments', 'revisions', 'dateModified', 'doc_id', 'tenderID', 'bids', 'documents', 'awards', 'questions', 'complaints', 'auctionUrl', 'status', 'auctionPeriod', 'awardPeriod', 'procurementMethod', 'awardCriteria', 'submissionMethod') + schematics_embedded_role)
edit_role = (blacklist('owner_token', 'owner', '_attachments', 'revisions', 'dateModified', 'doc_id', 'tenderID', 'bids', 'documents', 'awards', 'questions', 'complaints', 'auctionUrl', 'auctionPeriod', 'awardPeriod', 'procurementMethod', 'awardCriteria', 'submissionMethod') + schematics_embedded_role)
cancel_role = whitelist('status')
view_role = (blacklist('owner', 'owner_token', '_attachments', 'revisions') + schematics_embedded_role)
listing_role = whitelist('dateModified', 'doc_id')
Expand Down Expand Up @@ -461,15 +461,15 @@ def __local_roles__(self):
tenderID = StringType() # TenderID should always be the same as the OCID. It is included to make the flattened data structure more convenient.
items = ListType(ModelType(Item), required=True, min_size=1) # The goods and services to be purchased, broken into line items wherever possible. Items should not be duplicated, but a quantity of 2 specified instead.
value = ModelType(Value, required=True) # The total estimated value of the procurement.
procurementMethod = StringType(choices=['Open', 'Selective', 'Limited']) # Specify tendering method as per GPA definitions of Open, Selective, Limited (http://www.wto.org/english/docs_e/legal_e/rev-gpr-94_01_e.htm)
procurementMethod = StringType(choices=['Open', 'Selective', 'Limited'], default='Open') # Specify tendering method as per GPA definitions of Open, Selective, Limited (http://www.wto.org/english/docs_e/legal_e/rev-gpr-94_01_e.htm)
procurementMethodRationale = StringType() # Justification of procurement method, especially in the case of Limited tendering.
procurementMethodRationale_en = StringType()
procurementMethodRationale_ru = StringType()
awardCriteria = StringType(choices=['Lowest Cost', 'Best Proposal', 'Best Value to Government', 'Single bid only']) # Specify the selection criteria, by lowest cost,
awardCriteria = StringType(choices=['Lowest Cost', 'Best Proposal', 'Best Value to Government', 'Single bid only'], default='Lowest Cost') # Specify the selection criteria, by lowest cost,
awardCriteriaDetails = StringType() # Any detailed or further information on the selection criteria.
awardCriteriaDetails_en = StringType()
awardCriteriaDetails_ru = StringType()
submissionMethod = StringType(choices=['Electronic Auction', 'Electronic Submission', 'Written', 'In Person']) # Specify the method by which bids must be submitted, in person, written, or electronic auction
submissionMethod = StringType(choices=['Electronic Auction', 'Electronic Submission', 'Written', 'In Person'], default='Electronic Auction') # Specify the method by which bids must be submitted, in person, written, or electronic auction
submissionMethodDetails = StringType() # Any detailed or further information on the submission method.
submissionMethodDetails_en = StringType()
submissionMethodDetails_ru = StringType()
Expand Down
13 changes: 7 additions & 6 deletions src/openprocurement/api/tests/tender.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ def test_create_tender_generated(self):
self.assertEqual(response.content_type, 'application/json')
tender = response.json['data']
self.assertEqual(set(tender), set([u'id', u'dateModified', u'tenderID', u'status', u'enquiryPeriod',
u'tenderPeriod', u'minimalStep', u'items', u'value', u'procuringEntity']))
u'tenderPeriod', u'minimalStep', u'items', u'value', u'procuringEntity',
u'procurementMethod', u'awardCriteria', u'submissionMethod']))
self.assertNotEqual(data['id'], tender['id'])
self.assertNotEqual(data['doc_id'], tender['id'])
self.assertNotEqual(data['tenderID'], tender['tenderID'])
Expand All @@ -317,7 +318,7 @@ def test_create_tender(self):
self.assertEqual(response.content_type, 'application/json')
tender = response.json['data']
self.assertEqual(set(tender) - set(test_tender_data), set(
[u'id', u'dateModified', u'tenderID', u'status']))
[u'id', u'dateModified', u'tenderID', u'status', u'procurementMethod', u'awardCriteria', u'submissionMethod']))
self.assertTrue(tender['id'] in response.headers['Location'])

response = self.app.get('/tenders/{}'.format(tender['id']))
Expand Down Expand Up @@ -419,12 +420,12 @@ def test_patch_tender(self):
self.assertIn('startDate', response.json['data']['tenderPeriod'])

response = self.app.patch_json('/tenders/{}'.format(
tender['id']), {'data': {'procurementMethod': 'Open'}})
tender['id']), {'data': {'procurementMethodRationale': 'Open'}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
new_tender = response.json['data']
new_dateModified = new_tender.pop('dateModified')
tender['procurementMethod'] = 'Open'
tender['procurementMethodRationale'] = 'Open'
self.assertEqual(tender, new_tender)
self.assertNotEqual(dateModified, new_dateModified)

Expand All @@ -439,7 +440,7 @@ def test_patch_tender(self):

revisions = self.db.get(tender['id']).get('revisions')
self.assertEqual(revisions[-1][u'changes'][0]['op'], u'remove')
self.assertEqual(revisions[-1][u'changes'][0]['path'], u'/procurementMethod')
self.assertEqual(revisions[-1][u'changes'][0]['path'], u'/procurementMethodRationale')

response = self.app.patch_json('/tenders/{}'.format(
tender['id']), {'data': {'items': [test_tender_data['items'][0]]}})
Expand Down Expand Up @@ -511,7 +512,7 @@ def test_dateModified_tender(self):
self.assertEqual(response.json['data']['dateModified'], dateModified)

response = self.app.patch_json('/tenders/{}'.format(
tender['id']), {'data': {'procurementMethod': 'Open'}})
tender['id']), {'data': {'procurementMethodRationale': 'Open'}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertNotEqual(response.json['data']['dateModified'], dateModified)
Expand Down

0 comments on commit 3424afa

Please sign in to comment.