Skip to content

Commit

Permalink
Merge pull request #63 from gorserg/fix_master
Browse files Browse the repository at this point in the history
Виправлення гілки master
  • Loading branch information
kroman0 committed Aug 26, 2016
2 parents 0fc5d0c + b41c02e commit f2eaeaf
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 150 deletions.
4 changes: 2 additions & 2 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ find-links = http://op:x9W3jZ@dist.quintagroup.com/op/
auto-checkout = openprocurement.api openprocurement.tender.openua openprocurement.tender.openeu

[sources]
openprocurement.tender.openua = git https://github.com/openprocurement/openprocurement.tender.openua.git branch=production
openprocurement.tender.openeu = git https://github.com/openprocurement/openprocurement.tender.openeu.git branch=production
openprocurement.tender.openua = git https://github.com/openprocurement/openprocurement.tender.openua.git
openprocurement.tender.openeu = git https://github.com/openprocurement/openprocurement.tender.openeu.git
openprocurement.api = git https://github.com/openprocurement/openprocurement.api.git branch=extend_acl_for_cd

[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,16 +785,20 @@ def test_put_tender_complaint_document(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']["status"], "pending")

response = self.app.put('/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id,
self.complaint_id,
doc_id,
self.complaint_owner_token),
'content',
content_type='application/msword',
status=403)
self.assertEqual(response.status, '403 Forbidden')
response = self.app.put(
'/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id, self.complaint_id, doc_id,
self.complaint_owner_token), 'content4',
content_type='application/msword')
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]["description"], "Can't update document in current (pending) complaint status")
key = response.json["data"]["url"].split('?')[-1]

response = self.app.get('/tenders/{}/complaints/{}/documents/{}?{}'.format(
self.tender_id, self.complaint_id, doc_id, key))
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/msword')
self.assertEqual(response.content_length, 8)
self.assertEqual(response.body, 'content4')

self.set_status('complete')

Expand Down Expand Up @@ -852,15 +856,13 @@ def test_patch_tender_complaint_document(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']["status"], "pending")

response = self.app.patch_json('/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id,
self.complaint_id,
doc_id,
self.complaint_owner_token),
{"data": {"description": "document description"}},
status=403)
self.assertEqual(response.status, '403 Forbidden')
response = self.app.patch_json(
'/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id, self.complaint_id, doc_id,
self.complaint_owner_token),
{"data": {"description": "document description2"}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]["description"], "Can't update document in current (pending) complaint status")
self.assertEqual(response.json['data']["description"], "document description2")

self.set_status('complete')

Expand Down Expand Up @@ -1662,15 +1664,20 @@ def test_put_tender_complaint_document(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']["status"], "pending")

response = self.app.put('/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id,
self.complaint_id,
doc_id,
self.complaint_owner_token),
'content', content_type='application/msword',
status=403)
self.assertEqual(response.status, '403 Forbidden')
response = self.app.put(
'/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id, self.complaint_id, doc_id,
self.complaint_owner_token), 'content4',
content_type='application/msword')
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]["description"], "Can't update document in current (pending) complaint status")
key = response.json["data"]["url"].split('?')[-1]

response = self.app.get('/tenders/{}/complaints/{}/documents/{}?{}'.format(
self.tender_id, self.complaint_id, doc_id, key))
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/msword')
self.assertEqual(response.content_length, 8)
self.assertEqual(response.body, 'content4')

self.set_status('complete')

Expand Down Expand Up @@ -1726,15 +1733,13 @@ def test_patch_tender_complaint_document(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']["status"], "pending")

response = self.app.patch_json('/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id,
self.complaint_id,
doc_id,
self.complaint_owner_token),
{"data": {"description": "document description"}},
status=403)
self.assertEqual(response.status, '403 Forbidden')
response = self.app.patch_json(
'/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id, self.complaint_id, doc_id,
self.complaint_owner_token),
{"data": {"description": "document description2"}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]["description"], "Can't update document in current (pending) complaint status")
self.assertEqual(response.json['data']["description"], "document description2")

self.set_status('complete')

Expand Down
129 changes: 78 additions & 51 deletions openprocurement/tender/competitivedialogue/tests/stage2/award.py
Original file line number Diff line number Diff line change
Expand Up @@ -2157,14 +2157,21 @@ def test_patch_tender_award_complaint_document(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['status'], 'pending')

response = self.app.put('/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, self.complaint_owner_token),
'content', content_type='application/msword',
status=403)
self.assertEqual(response.status, '403 Forbidden')
response = self.app.put(
'/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id, self.award_id,
self.complaint_id, doc_id,
self.complaint_owner_token),
'content2', content_type='application/msword')
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]['description'],
"Can't update document in current (pending) complaint status")
key = response.json["data"]["url"].split('?')[-1]

response = self.app.get('/tenders/{}/awards/{}/complaints/{}/documents/{}?{}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, key))
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/msword')
self.assertEqual(response.content_length, 8)
self.assertEqual(response.body, 'content2')

self.set_status('complete')

Expand Down Expand Up @@ -2345,29 +2352,36 @@ def test_put_tender_award_complaint_document(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['status'], 'pending')

response = self.app.put('/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, self.complaint_owner_token),
'content',
content_type='application/msword',
status=403)
self.assertEqual(response.status, '403 Forbidden')
response = self.app.put(
'/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id, self.award_id,
self.complaint_id, doc_id,
self.complaint_owner_token),
'content4', content_type='application/msword')
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]['description'],
"Can't update document in current (pending) complaint status")
key = response.json["data"]["url"].split('?')[-1]

response = self.app.post_json('/tenders/{}/cancellations'.format(self.tender_id),
{'data': {'reason': 'cancellation reason', 'status': 'active',
'cancellationOf': 'lot', 'relatedLot': self.lots[0]['id']}})
response = self.app.get('/tenders/{}/awards/{}/complaints/{}/documents/{}?{}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, key))
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/msword')
self.assertEqual(response.content_length, 8)
self.assertEqual(response.body, 'content4')

response = self.app.post_json('/tenders/{}/cancellations'.format(self.tender_id), {'data': {
'reason': 'cancellation reason',
'status': 'active',
"cancellationOf": "lot",
"relatedLot": self.lots[0]['id']
}})
self.assertEqual(response.status, '201 Created')

response = self.app.put('/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, self.complaint_owner_token),
upload_files=[('file', 'name.doc', 'content3')],
status=403)
upload_files=[('file', 'name.doc', 'content3')], status=403)
self.assertEqual(response.status, '403 Forbidden')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]['description'],
'Can update document only in active lot status')
self.assertEqual(response.json['errors'][0]["description"], "Can update document only in active lot status")

def test_patch_tender_award_complaint_document(self):
response = self.app.post('/tenders/{}/awards/{}/complaints/{}/documents?acc_token={}'.format(
Expand Down Expand Up @@ -2406,13 +2420,14 @@ def test_patch_tender_award_complaint_document(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['status'], 'pending')

response = self.app.patch_json('/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, self.complaint_owner_token),
{'data': {'description': 'document description'}}, status=403)
self.assertEqual(response.status, '403 Forbidden')
response = self.app.patch_json(
'/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id, self.award_id,
self.complaint_id, doc_id,
self.complaint_owner_token),
{"data": {"description": "document description2"}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]['description'],
"Can't update document in current (pending) complaint status")
self.assertEqual(response.json['data']["description"], "document description2")

response = self.app.post_json('/tenders/{}/cancellations'.format(self.tender_id),
{'data': {'reason': 'cancellation reason', 'status': 'active',
Expand Down Expand Up @@ -4787,15 +4802,21 @@ def test_patch_tender_award_complaint_document(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['status'], 'pending')

response = self.app.put('/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, self.complaint_owner_token),
'content',
content_type='application/msword',
status=403)
self.assertEqual(response.status, '403 Forbidden')
response = self.app.put(
'/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id, self.award_id,
self.complaint_id, doc_id,
self.complaint_owner_token),
'content2', content_type='application/msword')
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]['description'],
"Can't update document in current (pending) complaint status")
key = response.json["data"]["url"].split('?')[-1]

response = self.app.get('/tenders/{}/awards/{}/complaints/{}/documents/{}?{}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, key))
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/msword')
self.assertEqual(response.content_length, 8)
self.assertEqual(response.body, 'content2')

self.set_status('complete')

Expand Down Expand Up @@ -4981,15 +5002,21 @@ def test_put_tender_award_complaint_document(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['status'], 'pending')

response = self.app.put('/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, self.complaint_owner_token),
'content',
content_type='application/msword',
status=403)
self.assertEqual(response.status, '403 Forbidden')
response = self.app.put(
'/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id, self.award_id,
self.complaint_id, doc_id,
self.complaint_owner_token),
'content4', content_type='application/msword')
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]['description'],
"Can't update document in current (pending) complaint status")
key = response.json["data"]["url"].split('?')[-1]

response = self.app.get('/tenders/{}/awards/{}/complaints/{}/documents/{}?{}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, key))
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/msword')
self.assertEqual(response.content_length, 8)
self.assertEqual(response.body, 'content4')

response = self.app.post_json('/tenders/{}/cancellations?acc_token={}'.format(self.tender_id,
self.tender_token),
Expand Down Expand Up @@ -5043,14 +5070,14 @@ def test_patch_tender_award_complaint_document(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['status'], 'pending')

response = self.app.patch_json('/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(
self.tender_id, self.award_id, self.complaint_id, doc_id, self.complaint_owner_token),
{'data': {'description': 'document description'}},
status=403)
self.assertEqual(response.status, '403 Forbidden')
response = self.app.patch_json(
'/tenders/{}/awards/{}/complaints/{}/documents/{}?acc_token={}'.format(self.tender_id, self.award_id,
self.complaint_id, doc_id,
self.complaint_owner_token),
{"data": {"description": "document description2"}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]['description'],
"Can't update document in current (pending) complaint status")
self.assertEqual(response.json['data']["description"], "document description2")

response = self.app.post_json('/tenders/{}/cancellations?acc_token={}'.format(self.tender_id,
self.tender_token),
Expand Down

0 comments on commit f2eaeaf

Please sign in to comment.