Skip to content

Commit

Permalink
fix auto-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
vmaksymiv committed Sep 12, 2017
1 parent a6d2fb8 commit bee34da
Showing 1 changed file with 0 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,55 +197,6 @@ class TenderStage2EU2LotQualificationComplaintResourceTest(TenderStage2EULotQual
test_create_tender_qualification_complaint = snitch(create_tender_2lot_qualification_complaint)
test_patch_tender_qualification_complaint = snitch(patch_tender_2lot_qualification_complaint)

def test_create_qualification_document_bot(self):
response = self.app.get('/tenders/{}/qualifications'.format(self.tender_id))
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.status, '200 OK')
qualifications = response.json['data']
old_authorization = self.app.authorization
self.app.authorization = ('Basic', ('bot', 'bot'))
response = self.app.post('/tenders/{}/qualifications/{}/documents'.format(self.tender_id, qualifications[0]['id']),
upload_files=[('file', 'edr_request.yaml','content')])
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
doc_id = response.json["data"]['id']
self.assertIn(doc_id, response.headers['Location'])
self.assertEqual('edr_request.yaml', response.json["data"]["title"])
if self.docservice:
self.assertIn('Signature=', response.json["data"]["url"])
self.assertIn('KeyID=', response.json["data"]["url"])
self.assertNotIn('Expires=', response.json["data"]["url"])
key = response.json["data"]["url"].split('/')[-1].split('?')[0]
tender = self.db.get(self.tender_id)
self.assertIn(key, tender['awards'][-1]['documents'][-1]["url"])
self.assertIn('Signature=', tender['awards'][-1]['documents'][-1]["url"])
self.assertIn('KeyID=', tender['awards'][-1]['documents'][-1]["url"])
self.assertNotIn('Expires=', tender['awards'][-1]['documents'][-1]["url"])
self.app.authorization = old_authorization

def test_patch_document_not_author(self):
response = self.app.get('/tenders/{}/qualifications'.format(self.tender_id))
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.status, '200 OK')
qualifications = response.json['data']
authorization = self.app.authorization
self.app.authorization = ('Basic', ('bot', 'bot'))

response = self.app.post('/tenders/{}/qualifications/{}/documents'.format(self.tender_id, qualifications[0]['id']),
upload_files=[('file', 'edr_request.yaml', 'content')])
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
doc_id = response.json["data"]['id']
self.assertIn(doc_id, response.headers['Location'])

self.app.authorization = authorization
response = self.app.patch_json('/tenders/{}/qualifications/{}/documents/{}?acc_token={}'.format(
self.tender_id, qualifications[0]['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")


class TenderStage2EUQualificationComplaintDocumentResourceTest(BaseCompetitiveDialogEUStage2ContentWebTest):
initial_status = 'active.tendering' # 'active.pre-qualification.stand-still' status sets in setUp
Expand Down

0 comments on commit bee34da

Please sign in to comment.