Skip to content

Commit

Permalink
Merge pull request #4 from yshalenyk/master
Browse files Browse the repository at this point in the history
testing with broker+access_token
  • Loading branch information
vmaksymiv committed Mar 22, 2016
2 parents b808f2c + 232d64d commit 8a7eef5
Show file tree
Hide file tree
Showing 11 changed files with 583 additions and 425 deletions.
7 changes: 7 additions & 0 deletions openprocurement/tender/openua/tests/auction.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def test_get_tender_auction_not_found(self):
])

def test_get_tender_auction(self):

self.app.authorization = ('Basic', ('auction', ''))
response = self.app.get('/tenders/{}/auction'.format(self.tender_id), status=403)
self.assertEqual(response.status, '403 Forbidden')
self.assertEqual(response.content_type, 'application/json')
Expand Down Expand Up @@ -337,6 +339,7 @@ class TenderLotAuctionResourceTest(TenderAuctionResourceTest):


def test_get_tender_auction(self):
self.app.authorization = ('Basic', ('auction', ''))
response = self.app.get('/tenders/{}/auction'.format(self.tender_id), status=403)
self.assertEqual(response.status, '403 Forbidden')
self.assertEqual(response.content_type, 'application/json')
Expand Down Expand Up @@ -633,6 +636,8 @@ class TenderMultipleLotAuctionResourceTest(TenderAuctionResourceTest):
initial_lots = 2 * test_lots

def test_get_tender_auction(self):

self.app.authorization = ('Basic', ('auction', ''))
response = self.app.get('/tenders/{}/auction'.format(self.tender_id), status=403)
self.assertEqual(response.status, '403 Forbidden')
self.assertEqual(response.content_type, 'application/json')
Expand Down Expand Up @@ -1029,6 +1034,8 @@ class TenderFeaturesAuctionResourceTest(BaseTenderUAContentWebTest):
]

def test_get_tender_auction(self):

self.app.authorization = ('Basic', ('auction', ''))
response = self.app.get('/tenders/{}/auction'.format(self.tender_id))
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
Expand Down
403 changes: 240 additions & 163 deletions openprocurement/tender/openua/tests/award.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion openprocurement/tender/openua/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def setUp(self):
self.app = webtest.TestApp(
"config:tests.ini", relative_to=os.path.dirname(__file__))
self.app.RequestClass = PrefixedRequestClass
self.app.authorization = ('Basic', ('token', ''))
self.app.authorization = ('Basic', ('broker', ''))
self.couchdb_server = self.app.app.registry.couchdb_server
self.db = self.app.app.registry.db

Expand Down
89 changes: 50 additions & 39 deletions openprocurement/tender/openua/tests/bid.py

Large diffs are not rendered by default.

131 changes: 72 additions & 59 deletions openprocurement/tender/openua/tests/cancellation.py

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions openprocurement/tender/openua/tests/complaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ def test_not_found(self):
u'url', u'name': u'complaint_id'}
])

response = self.app.post('/tenders/{}/complaints/{}/documents'.format(self.tender_id, self.complaint_id), status=404, upload_files=[
response = self.app.post('/tenders/{}/complaints/{}/documents?acc_token={}'.format(
self.tender_id, self.complaint_id, self.complaint_owner_token), status=404, upload_files=[
('invalid_value', 'name.doc', 'content')])
self.assertEqual(response.status, '404 Not Found')
self.assertEqual(response.content_type, 'application/json')
Expand Down Expand Up @@ -565,8 +566,8 @@ def test_not_found(self):
])

def test_create_tender_complaint_document(self):
response = self.app.post('/tenders/{}/complaints/{}/documents'.format(
self.tender_id, self.complaint_id), upload_files=[('file', 'name.doc', 'content')], status=403)
response = self.app.post('/tenders/{}/complaints/{}/documents?acc_token={}'.format(
self.tender_id, self.complaint_id, self.tender_token), upload_files=[('file', 'name.doc', 'content')], status=403)
self.assertEqual(response.status, '403 Forbidden')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]["description"], "Can't add document in current (draft) complaint status")
Expand Down Expand Up @@ -617,8 +618,8 @@ def test_create_tender_complaint_document(self):

self.set_status('complete')

response = self.app.post('/tenders/{}/complaints/{}/documents'.format(
self.tender_id, self.complaint_id), upload_files=[('file', 'name.doc', 'content')], status=403)
response = self.app.post('/tenders/{}/complaints/{}/documents?acc_token={}'.format(
self.tender_id, self.complaint_id, self.complaint_owner_token), upload_files=[('file', 'name.doc', 'content')], status=403)
self.assertEqual(response.status, '403 Forbidden')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['errors'][0]["description"], "Can't add document in current (complete) tender status")
Expand All @@ -631,7 +632,8 @@ def test_put_tender_complaint_document(self):
doc_id = response.json["data"]['id']
self.assertIn(doc_id, response.headers['Location'])

response = self.app.put('/tenders/{}/complaints/{}/documents/{}'.format(self.tender_id, self.complaint_id, doc_id),
response = self.app.put('/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(
self.tender_id, self.complaint_id, doc_id, self.complaint_owner_token),
status=404,
upload_files=[('invalid_name', 'name.doc', 'content')])
self.assertEqual(response.status, '404 Not Found')
Expand All @@ -642,8 +644,8 @@ def test_put_tender_complaint_document(self):
u'body', u'name': u'file'}
])

response = self.app.put('/tenders/{}/complaints/{}/documents/{}'.format(
self.tender_id, self.complaint_id, doc_id), upload_files=[('file', 'name.doc', 'content2')], status=403)
response = self.app.put('/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(
self.tender_id, self.complaint_id, doc_id, self.tender_token), upload_files=[('file', 'name.doc', 'content2')], 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 author")
Expand Down Expand Up @@ -710,7 +712,8 @@ def test_patch_tender_complaint_document(self):
doc_id = response.json["data"]['id']
self.assertIn(doc_id, response.headers['Location'])

response = self.app.patch_json('/tenders/{}/complaints/{}/documents/{}'.format(self.tender_id, self.complaint_id, doc_id), {"data": {"description": "document description"}}, status=403)
response = self.app.patch_json('/tenders/{}/complaints/{}/documents/{}?acc_token={}'.format(
self.tender_id, self.complaint_id, doc_id, self.tender_token), {"data": {"description": "document description"}}, 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 author")
Expand Down

0 comments on commit 8a7eef5

Please sign in to comment.