Skip to content

Commit

Permalink
Merge branch 'production' into a165337421066728_create_accreditations
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Nov 25, 2016
2 parents fb86aef + ae00d57 commit 423d699
Show file tree
Hide file tree
Showing 122 changed files with 3,086 additions and 1,933 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
language: python
sudo: false
sudo: required
before_script:
- sudo add-apt-repository ppa:chris-lea/libsodium -y
- sudo apt-get -qq update
- sudo apt-get install libsodium13 -y
python:
- "2.7"
services:
Expand Down
133 changes: 105 additions & 28 deletions docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ def do_request(self, req, status=None, expect_errors=None):
class TenderResourceTest(BaseTenderWebTest):
initial_data = test_tender_data
initial_bids = test_bids
docservice = True

def setUp(self):
self.app = DumpsTestAppwebtest(
Expand All @@ -280,6 +281,12 @@ def setUp(self):
self.app.authorization = ('Basic', ('broker', ''))
self.couchdb_server = self.app.app.registry.couchdb_server
self.db = self.app.app.registry.db
if self.docservice:
self.setUpDS()
self.app.app.registry.docservice_url = 'http://public.docs-sandbox.openprocurement.org'

def generate_docservice_url(self):
return super(TenderResourceTest, self).generate_docservice_url().replace('/localhost/', '/public.docs-sandbox.openprocurement.org/')

def test_docs_2pc(self):
# Creating tender in draft status
Expand Down Expand Up @@ -394,8 +401,13 @@ def test_docs_tutorial(self):
#

with open('docs/source/tutorial/upload-tender-notice.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/documents?acc_token={}'.format(
self.tender_id, owner_token), upload_files=[('file', u'Notice.pdf', 'content')])
response = self.app.post_json('/tenders/{}/documents?acc_token={}'.format(self.tender_id, owner_token),
{'data': {
'title': u'Notice.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '201 Created')

doc_id = response.json["data"]["id"]
Expand All @@ -415,8 +427,13 @@ def test_docs_tutorial(self):
self.assertEqual(response.status, '200 OK')

with open('docs/source/tutorial/upload-award-criteria.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/documents?acc_token={}'.format(
self.tender_id, owner_token), upload_files=[('file', u'AwardCriteria.pdf', 'content')])
response = self.app.post_json('/tenders/{}/documents?acc_token={}'.format(self.tender_id, owner_token),
{'data': {
'title': u'AwardCriteria.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '201 Created')

doc_id = response.json["data"]["id"]
Expand All @@ -427,8 +444,13 @@ def test_docs_tutorial(self):
self.assertEqual(response.status, '200 OK')

with open('docs/source/tutorial/update-award-criteria.http', 'w') as self.app.file_obj:
response = self.app.put('/tenders/{}/documents/{}?acc_token={}'.format(
self.tender_id, doc_id, owner_token), upload_files=[('file', 'AwardCriteria-2.pdf', 'content2')])
response = self.app.put_json('/tenders/{}/documents/{}?acc_token={}'.format(self.tender_id, doc_id, owner_token),
{'data': {
'title': u'AwardCriteria-2.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '200 OK')

with open('docs/source/tutorial/tender-documents-3.http', 'w') as self.app.file_obj:
Expand Down Expand Up @@ -482,8 +504,13 @@ def test_docs_tutorial(self):
#

with open('docs/source/tutorial/upload-bid-proposal.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/bids/{}/documents?acc_token={}'.format(
self.tender_id, bid1_id, bids_access[bid1_id]), upload_files=[('file', 'Proposal.pdf', 'content')])
response = self.app.post_json('/tenders/{}/bids/{}/documents?acc_token={}'.format(self.tender_id, bid1_id, bids_access[bid1_id]),
{'data': {
'title': u'Proposal.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '201 Created')

with open('docs/source/tutorial/bidder-documents.http', 'w') as self.app.file_obj:
Expand Down Expand Up @@ -594,8 +621,13 @@ def test_docs_tutorial(self):
#

with open('docs/source/tutorial/tender-contract-upload-document.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/contracts/{}/documents?acc_token={}'.format(
self.tender_id, self.contract_id, owner_token), upload_files=[('file', 'contract_first_document.doc', 'content')])
response = self.app.post_json('/tenders/{}/contracts/{}/documents?acc_token={}'.format(self.tender_id, self.contract_id, owner_token),
{'data': {
'title': u'contract_first_document.doc',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/msword',
}})
self.assertEqual(response.status, '201 Created')

with open('docs/source/tutorial/tender-contract-get-documents.http', 'w') as self.app.file_obj:
Expand All @@ -604,8 +636,13 @@ def test_docs_tutorial(self):
self.assertEqual(response.status, '200 OK')

with open('docs/source/tutorial/tender-contract-upload-second-document.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/contracts/{}/documents?acc_token={}'.format(
self.tender_id, self.contract_id, owner_token), upload_files=[('file', 'contract_second_document.doc', 'content')])
response = self.app.post_json('/tenders/{}/contracts/{}/documents?acc_token={}'.format(self.tender_id, self.contract_id, owner_token),
{'data': {
'title': u'contract_second_document.doc',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/msword',
}})
self.assertEqual(response.status, '201 Created')

with open('docs/source/tutorial/tender-contract-get-documents-again.http', 'w') as self.app.file_obj:
Expand Down Expand Up @@ -650,8 +687,13 @@ def test_docs_tutorial(self):
#

with open('docs/source/tutorial/upload-cancellation-doc.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/cancellations/{}/documents?acc_token={}'.format(
self.tender_id, cancellation_id, owner_token), upload_files=[('file', u'Notice.pdf', 'content')])
response = self.app.post_json('/tenders/{}/cancellations/{}/documents?acc_token={}'.format(self.tender_id, cancellation_id, owner_token),
{'data': {
'title': u'Notice.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
cancellation_doc_id = response.json['data']['id']
self.assertEqual(response.status, '201 Created')

Expand All @@ -661,8 +703,13 @@ def test_docs_tutorial(self):
self.assertEqual(response.status, '200 OK')

with open('docs/source/tutorial/update-cancellation-doc.http', 'w') as self.app.file_obj:
response = self.app.put('/tenders/{}/cancellations/{}/documents/{}?acc_token={}'.format(
self.tender_id, cancellation_id, cancellation_doc_id, owner_token), upload_files=[('file', 'Notice-2.pdf', 'content2')])
response = self.app.put_json('/tenders/{}/cancellations/{}/documents/{}?acc_token={}'.format(self.tender_id, cancellation_id, cancellation_doc_id, owner_token),
{'data': {
'title': u'Notice-2.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '200 OK')

# Activating the request and cancelling tender
Expand Down Expand Up @@ -692,8 +739,13 @@ def test_docs_complaints(self):
complaint1_token = response.json['access']['token']

with open('docs/source/complaints/complaint-submission-upload.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/complaints/{}/documents?acc_token={}'.format(
self.tender_id, complaint1_id, complaint1_token), upload_files=[('file', u'Complaint_Attachement.pdf', 'content')])
response = self.app.post_json('/tenders/{}/complaints/{}/documents?acc_token={}'.format(
self.tender_id, complaint1_id, complaint1_token), {'data': {
'title': u'Complaint_Attachement.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '201 Created')

with open('docs/source/complaints/complaint-claim.http', 'w') as self.app.file_obj:
Expand Down Expand Up @@ -807,8 +859,13 @@ def test_docs_complaints(self):
self.app.authorization = ('Basic', ('reviewer', ''))

with open('docs/source/complaints/complaint-resolution-upload.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/complaints/{}/documents'.format(
self.tender_id, complaint3_id), upload_files=[('file', u'ComplaintResolution.pdf', 'content')])
response = self.app.post_json('/tenders/{}/complaints/{}/documents'.format(
self.tender_id, complaint3_id), {'data': {
'title': u'ComplaintResolution.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '201 Created')

with open('docs/source/complaints/complaint-resolve.http', 'w') as self.app.file_obj:
Expand Down Expand Up @@ -864,8 +921,13 @@ def test_docs_complaints(self):
award_id = [i['id'] for i in response.json['data'] if i['status'] == 'pending'][0]

with open('docs/source/qualification/award-pending-upload.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/awards/{}/documents?acc_token={}'.format(
self.tender_id, award_id, self.tender_token), upload_files=[('file', u'Unsuccessful_Reason.pdf', 'content')])
response = self.app.post_json('/tenders/{}/awards/{}/documents?acc_token={}'.format(
self.tender_id, award_id, self.tender_token), {'data': {
'title': u'Unsuccessful_Reason.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '201 Created')

with open('docs/source/qualification/award-pending-unsuccessful.http', 'w') as self.app.file_obj:
Expand Down Expand Up @@ -895,8 +957,13 @@ def test_docs_complaints(self):
award_id3 = [i['id'] for i in response.json['data'] if i['status'] == 'pending'][0]

with open('docs/source/qualification/award-active-cancel-upload.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/awards/{}/documents?acc_token={}'.format(
self.tender_id, award_id3, self.tender_token), upload_files=[('file', u'Cancellation_Reason.pdf', 'content')])
response = self.app.post_json('/tenders/{}/awards/{}/documents?acc_token={}'.format(
self.tender_id, award_id3, self.tender_token), {'data': {
'title': u'Cancellation_Reason.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '201 Created')

with open('docs/source/qualification/award-active-cancel-disqualify.http', 'w') as self.app.file_obj:
Expand All @@ -919,8 +986,13 @@ def test_docs_complaints(self):
complaint1_token = response.json['access']['token']

with open('docs/source/complaints/award-complaint-submission-upload.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/awards/{}/complaints/{}/documents?acc_token={}'.format(
self.tender_id, award_id, complaint1_id, complaint1_token), upload_files=[('file', u'Complaint_Attachement.pdf', 'content')])
response = self.app.post_json('/tenders/{}/awards/{}/complaints/{}/documents?acc_token={}'.format(
self.tender_id, award_id, complaint1_id, complaint1_token), {'data': {
'title': u'Complaint_Attachement.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '201 Created')

with open('docs/source/complaints/award-complaint-claim.http', 'w') as self.app.file_obj:
Expand Down Expand Up @@ -1030,8 +1102,13 @@ def test_docs_complaints(self):
self.app.authorization = ('Basic', ('reviewer', ''))

with open('docs/source/complaints/award-complaint-resolution-upload.http', 'w') as self.app.file_obj:
response = self.app.post('/tenders/{}/awards/{}/complaints/{}/documents'.format(
self.tender_id, award_id, complaint3_id), upload_files=[('file', u'ComplaintResolution.pdf', 'content')])
response = self.app.post_json('/tenders/{}/awards/{}/complaints/{}/documents'.format(
self.tender_id, award_id, complaint3_id), {'data': {
'title': u'ComplaintResolution.pdf',
'url': self.generate_docservice_url(),
'hash': 'md5:' + '0' * 32,
'format': 'application/pdf',
}})
self.assertEqual(response.status, '201 Created')

with open('docs/source/complaints/award-complaint-resolve.http', 'w') as self.app.file_obj:
Expand Down
23 changes: 12 additions & 11 deletions docs/source/complaints/award-complaint-answer.http
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PATCH /api/2.3/tenders/1c34544d0e6144f18886b6e59fb8256d/awards/e9a940c30ca142af9cfc261a7536d8ff/complaints/cfa1dd69996642c1b00ed0693ef9f71c?acc_token=cc248e7ef9674336aa17d4528e5e5c77 HTTP/1.0
PATCH /api/2.3/tenders/eeb9177097a14a8c80ca0d1c8b202a00/awards/86d3f73dd7094865a9fd4966584c62ae/complaints/523f13eba5464cf1a5fe165009f78f3a?acc_token=a8d118cc5aab4c9e8e6fafe89d2c4615 HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 442
Content-Type: application/json
Expand All @@ -22,14 +22,15 @@ Content-Type: application/json; charset=UTF-8
"status": "answered",
"documents": [
{
"hash": "md5:00000000000000000000000000000000",
"author": "complaint_owner",
"title": "Complaint_Attachement.pdf",
"url": "http://api-sandbox.openprocurement.org/api/2.3/tenders/1c34544d0e6144f18886b6e59fb8256d/awards/e9a940c30ca142af9cfc261a7536d8ff/complaints/cfa1dd69996642c1b00ed0693ef9f71c/documents/98b8b4ec77a54382a4e66ca4d72c6add?download=46648e80263a4020b54907e1ecbebcfd",
"url": "http://public.docs-sandbox.openprocurement.org/get/b1d288ec9d35491c83d5953a79d45071?KeyID=a1a42480&Signature=twSUg3Pm7UJJUoKW0E5lJ9fyDBuGXW3VHAKfq8j7q%252B8ysx%2FjgW1Q9B3mLNrHDS3UGm0rNjbKeZcGbGylCQvCDWIAAAAxAAAAZAAAADIAAAA4AAAAOAAAAGUAAABjAAAA",
"format": "application/pdf",
"documentOf": "tender",
"datePublished": "2016-06-10T15:29:41.237732+03:00",
"id": "98b8b4ec77a54382a4e66ca4d72c6add",
"dateModified": "2016-06-10T15:29:41.237780+03:00"
"datePublished": "2016-07-21T17:17:57.441970+03:00",
"id": "ae2cd7a20eab46c0b2d62cf2510936ca",
"dateModified": "2016-07-21T17:17:57.442018+03:00"
}
],
"description": "complaint description",
Expand Down Expand Up @@ -57,13 +58,13 @@ Content-Type: application/json; charset=UTF-8
"type": "claim",
"title": "complaint title",
"tendererAction": "Виправлено неконкурентні умови",
"dateAnswered": "2016-06-10T15:29:42.291775+03:00",
"tendererActionDate": "2016-06-10T15:29:42.291818+03:00",
"dateSubmitted": "2016-06-10T15:29:41.517279+03:00",
"complaintID": "UA-2016-06-10-000001.5",
"date": "2016-06-10T15:29:40.968080+03:00",
"dateAnswered": "2016-07-21T17:17:58.552718+03:00",
"tendererActionDate": "2016-07-21T17:17:58.552758+03:00",
"dateSubmitted": "2016-07-21T17:17:57.747245+03:00",
"complaintID": "UA-2016-07-21-000001.5",
"date": "2016-07-21T17:17:58.567638+03:00",
"resolution": "Виправлено неконкурентні умови",
"id": "cfa1dd69996642c1b00ed0693ef9f71c"
"id": "523f13eba5464cf1a5fe165009f78f3a"
}
}

19 changes: 10 additions & 9 deletions docs/source/complaints/award-complaint-claim.http
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PATCH /api/2.3/tenders/1c34544d0e6144f18886b6e59fb8256d/awards/e9a940c30ca142af9cfc261a7536d8ff/complaints/cfa1dd69996642c1b00ed0693ef9f71c?acc_token=a184e84664904d1cb4f81345149aa372 HTTP/1.0
PATCH /api/2.3/tenders/eeb9177097a14a8c80ca0d1c8b202a00/awards/86d3f73dd7094865a9fd4966584c62ae/complaints/523f13eba5464cf1a5fe165009f78f3a?acc_token=c5ced861db6d4507a2c3964604a1ca1a HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 29
Content-Type: application/json
Expand All @@ -19,14 +19,15 @@ Content-Type: application/json; charset=UTF-8
"status": "claim",
"documents": [
{
"hash": "md5:00000000000000000000000000000000",
"author": "complaint_owner",
"title": "Complaint_Attachement.pdf",
"url": "http://api-sandbox.openprocurement.org/api/2.3/tenders/1c34544d0e6144f18886b6e59fb8256d/awards/e9a940c30ca142af9cfc261a7536d8ff/complaints/cfa1dd69996642c1b00ed0693ef9f71c/documents/98b8b4ec77a54382a4e66ca4d72c6add?download=46648e80263a4020b54907e1ecbebcfd",
"url": "http://public.docs-sandbox.openprocurement.org/get/b1d288ec9d35491c83d5953a79d45071?KeyID=a1a42480&Signature=twSUg3Pm7UJJUoKW0E5lJ9fyDBuGXW3VHAKfq8j7q%252B8ysx%2FjgW1Q9B3mLNrHDS3UGm0rNjbKeZcGbGylCQvCDWIAAAAxAAAAZAAAADIAAAA4AAAAOAAAAGUAAABjAAAA",
"format": "application/pdf",
"documentOf": "tender",
"datePublished": "2016-06-10T15:29:41.237732+03:00",
"id": "98b8b4ec77a54382a4e66ca4d72c6add",
"dateModified": "2016-06-10T15:29:41.237780+03:00"
"datePublished": "2016-07-21T17:17:57.441970+03:00",
"id": "ae2cd7a20eab46c0b2d62cf2510936ca",
"dateModified": "2016-07-21T17:17:57.442018+03:00"
}
],
"description": "complaint description",
Expand All @@ -51,11 +52,11 @@ Content-Type: application/json; charset=UTF-8
"locality": "м. Вінниця"
}
},
"dateSubmitted": "2016-06-10T15:29:41.517279+03:00",
"complaintID": "UA-2016-06-10-000001.5",
"date": "2016-06-10T15:29:40.968080+03:00",
"dateSubmitted": "2016-07-21T17:17:57.747245+03:00",
"complaintID": "UA-2016-07-21-000001.5",
"date": "2016-07-21T17:17:57.759085+03:00",
"type": "claim",
"id": "cfa1dd69996642c1b00ed0693ef9f71c"
"id": "523f13eba5464cf1a5fe165009f78f3a"
}
}

0 comments on commit 423d699

Please sign in to comment.