Skip to content

Commit

Permalink
Merge pull request #111 from kukirokuk/a204388103819339_bid_credentia…
Browse files Browse the repository at this point in the history
…ls_and_transfer_tests

Add access credentials for stage 2 bid and tests
  • Loading branch information
vmaksymiv committed Jan 5, 2017
2 parents 5bf68d1 + ada81f0 commit f155374
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ def test_create_tender_bidder(self):
self.assertEqual(bid['tenderers'][0]['name'], test_bids[0]['tenderers'][0]['name'])
self.assertIn('id', bid)
self.assertIn(bid['id'], response.headers['Location'])
self.assertNotIn('transfer_token', bid)
self.assertIn('transfer', response.json['access'])

# Create bids in all possible statues
for status in ('active', 'unsuccessful', 'deleted', 'invalid'):
Expand Down Expand Up @@ -322,6 +324,8 @@ def test_patch_tender_bidder(self):
self.assertEqual(response.content_type, 'application/json')
bid = response.json['data']
bid_token = response.json['access']['token']
self.assertNotIn('transfer_token', bid)
self.assertIn('transfer', response.json['access'])

# Update tenders[0].name, and check response fields
response = self.app.patch_json('/tenders/{}/bids/{}?acc_token={}'.format(self.tender_id, bid['id'], bid_token),
Expand All @@ -338,6 +342,7 @@ def test_patch_tender_bidder(self):
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data']['date'], bid['date'])
self.assertEqual(response.json['data']['tenderers'][0]['name'], bid['tenderers'][0]['name'])
self.assertNotIn('transfer_token', bid)

# Try update bidder amount, return Null
response = self.app.patch_json('/tenders/{}/bids/{}?acc_token={}'.format(self.tender_id, bid['id'], bid_token),
Expand Down Expand Up @@ -404,6 +409,7 @@ def test_get_tender_bidder(self):
self.assertEqual(response.content_type, 'application/json')
bid = response.json['data']
bid_token = response.json['access']['token']
self.assertNotIn('transfer_token', bid)

# Create another bidder
bidder_data['identifier']['id'] = u"00037257"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ def test_create_tender_complaint(self):
complaint = response.json['data']
owner_token = response.json['access']['token']
self.assertEqual(complaint['author']['name'], author['name'])
self.assertNotIn('transfer_token', complaint)
self.assertIn('transfer', response.json['access'])
self.assertIn('id', complaint)
self.assertIn(complaint['id'], response.headers['Location'])

Expand Down Expand Up @@ -214,6 +216,8 @@ def test_patch_tender_complaint(self):
'author': author}})
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
self.assertNotIn('transfer_token', response.json['data'])
self.assertIn('transfer', response.json['access'])
complaint = response.json['data']
owner_token = response.json['access']['token']

Expand All @@ -230,6 +234,7 @@ def test_patch_tender_complaint(self):
{"data": {"title": "claim title",}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']["title"], "claim title")
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'],
owner_token),
Expand Down Expand Up @@ -398,6 +403,7 @@ def test_get_tender_complaint(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data'], complaint)
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.get('/tenders/{}/complaints/some_id'.format(self.tender_id), status=404)
self.assertEqual(response.status, '404 Not Found')
Expand Down Expand Up @@ -1032,6 +1038,8 @@ def test_create_tender_complaint(self):
self.assertEqual(complaint['author']['name'], author['name'])
self.assertIn('id', complaint)
self.assertIn(complaint['id'], response.headers['Location'])
self.assertNotIn('transfer_token', complaint)
self.assertIn('transfer', response.json['access'])

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'],
self.tender_token),
Expand Down Expand Up @@ -1088,6 +1096,8 @@ def test_patch_tender_complaint(self):
'author': author}})
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
self.assertNotIn('transfer_token', response.json['data'])
self.assertIn('transfer', response.json['access'])
complaint = response.json['data']
owner_token = response.json['access']['token']

Expand All @@ -1104,6 +1114,7 @@ def test_patch_tender_complaint(self):
{"data": {"title": "claim title"}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']["title"], "claim title")
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'],
owner_token),
Expand Down Expand Up @@ -1271,7 +1282,7 @@ def test_get_tender_complaint(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data'], complaint)

self.assertNotIn('transfer_token', response.json['data'])
response = self.app.get('/tenders/{}/complaints/some_id'.format(self.tender_id), status=404)
self.assertEqual(response.status, '404 Not Found')
self.assertEqual(response.content_type, 'application/json')
Expand Down Expand Up @@ -1331,6 +1342,8 @@ def test_create_tender_complaint(self):
self.assertEqual(response.content_type, 'application/json')
complaint = response.json['data']
owner_token = response.json['access']['token']
self.assertNotIn('transfer_token', complaint)
self.assertIn('transfer', response.json['access'])
self.assertEqual(complaint['author']['name'], author['name'])
self.assertIn('id', complaint)
self.assertIn(complaint['id'], response.headers['Location'])
Expand All @@ -1355,6 +1368,7 @@ def test_create_tender_complaint(self):
self.assertEqual(response.json['data']["status"], "answered")
self.assertEqual(response.json['data']["resolutionType"], "invalid")
self.assertEqual(response.json['data']["resolution"], "spam 100% " * 3)
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'],
owner_token),
Expand Down
14 changes: 14 additions & 0 deletions openprocurement/tender/competitivedialogue/tests/stage1/tender.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ def test_listing_draft(self):
response = self.app.post_json('/tenders', {'data': test_tender_data_eu})
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
self.assertIn('transfer', response.json['access'])
self.assertNotIn('transfer_token', response.json['data'])
tenders.append(response.json['data'])
response = self.app.post_json('/tenders', {'data': data})
self.assertEqual(response.status, '201 Created')
Expand Down Expand Up @@ -640,6 +642,9 @@ def test_create_tender(self):
response = self.app.post_json('/tenders', {"data": test_tender_data_eu})
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
self.assertNotIn('transfer_token', response.json['data'])
self.assertIn('transfer', response.json['access'])

tender = response.json['data']
tender_set = set(tender)
if 'procurementMethodDetails' in tender_set:
Expand Down Expand Up @@ -698,6 +703,7 @@ def test_get_tender(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data'], tender)
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.get('/tenders/{}?opt_jsonp=callback'.format(tender['id']))
self.assertEqual(response.status, '200 OK')
Expand Down Expand Up @@ -915,6 +921,7 @@ def test_patch_tender(self):
self.assertEqual(response.content_type, 'application/json')
self.assertIn('invalidationDate', response.json['data']['enquiryPeriod'])
new_tender = response.json['data']
self.assertNotIn('transfer_token', new_tender);
new_enquiryPeriod = new_tender.pop('enquiryPeriod')
new_dateModified = new_tender.pop('dateModified')
tender.pop('enquiryPeriod')
Expand Down Expand Up @@ -1664,6 +1671,8 @@ def test_listing_draft(self):
response = self.app.post_json('/tenders', {'data': test_tender_data_ua})
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
self.assertIn('transfer', response.json['access'])
self.assertNotIn('transfer_token', response.json['data'])
tenders.append(response.json['data'])
response = self.app.post_json('/tenders', {'data': data})
self.assertEqual(response.status, '201 Created')
Expand Down Expand Up @@ -1926,6 +1935,9 @@ def test_create_tender(self):
response = self.app.post_json('/tenders', {"data": test_tender_data_ua})
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
self.assertNotIn('transfer_token', response.json['data'])
self.assertIn('transfer', response.json['access'])

tender = response.json['data']
tender_set = set(tender)
if 'procurementMethodDetails' in tender_set:
Expand Down Expand Up @@ -1982,6 +1994,7 @@ def test_get_tender(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data'], tender)
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.get('/tenders/{}?opt_jsonp=callback'.format(tender['id']))
self.assertEqual(response.status, '200 OK')
Expand Down Expand Up @@ -2195,6 +2208,7 @@ def test_patch_tender_aaa(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertNotEqual(response.json['data']['status'], 'cancelled')
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.patch_json('/tenders/{}?acc_token={}'.format(tender['id'], owner_token), {'data': {'procuringEntity': {'kind': 'defense'}}})
self.assertEqual(response.status, '200 OK')
Expand Down
10 changes: 10 additions & 0 deletions openprocurement/tender/competitivedialogue/tests/stage2/award.py
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,8 @@ def test_create_tender_award_complaint(self):

self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
self.assertIn('transfer', response.json['access'])
self.assertNotIn('transfer_token', response.json['data'])
complaint = response.json['data']
self.assertEqual(complaint['author']['name'], author['name'])
self.assertIn('id', complaint)
Expand Down Expand Up @@ -1246,6 +1248,7 @@ def test_patch_tender_award_complaint(self):
{'data': {'title': 'claim title'}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['title'], 'claim title')
self.assertNotIn('transfer_token', response.json['data'])

# set complaints to status pending
response = self.app.patch_json('/tenders/{}/awards/{}/complaints/{}?acc_token={}'.format(
Expand Down Expand Up @@ -1395,6 +1398,7 @@ def test_get_tender_award_complaint(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data'], complaint)
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.get('/tenders/{}/awards/{}/complaints/some_id'.format(self.tender_id, self.award_id),
status=404)
Expand Down Expand Up @@ -3904,6 +3908,8 @@ def test_create_tender_award_complaint(self):
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
complaint = response.json['data']
self.assertIn('transfer', response.json['access'])
self.assertNotIn('transfer_token', response.json['data'])
self.assertEqual(complaint['author']['name'], author['name'])
self.assertIn('id', complaint)
self.assertIn(complaint['id'], response.headers['Location'])
Expand Down Expand Up @@ -3935,6 +3941,8 @@ def test_patch_tender_award_complaint(self):
self.assertEqual(response.content_type, 'application/json')
complaint = response.json['data']
owner_token = response.json['access']['token']
self.assertIn('transfer', response.json['access'])
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.patch_json('/tenders/{}/awards/{}/complaints/{}'.format(
self.tender_id, self.award_id, complaint['id']), {'data': {'status': 'cancelled',
Expand All @@ -3956,6 +3964,7 @@ def test_patch_tender_award_complaint(self):
{'data': {'title': 'claim title',}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['title'], 'claim title')
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.patch_json('/tenders/{}/awards/{}/complaints/{}?acc_token={}'.format(
self.tender_id, self.award_id, complaint['id'], owner_token), {'data': {'status': 'pending'}})
Expand Down Expand Up @@ -4089,6 +4098,7 @@ def test_get_tender_award_complaint(self):
self.tender_id, self.award_id, complaint['id']))
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertNotIn('transfer_token', response.json['data'])
self.assertEqual(response.json['data'], complaint)

response = self.app.get('/tenders/{}/awards/{}/complaints/some_id'.format(self.tender_id, self.award_id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3070,6 +3070,7 @@ def test_get_tender_bidder(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data'], bid)
self.assertNotIn('transfer_token', response.json['data'])

self.set_status('active.qualification')

Expand Down Expand Up @@ -3278,6 +3279,8 @@ def test_1_draft_bid(self):
"value": {"amount": 500}}})
self.assertEqual(response.status, '201 Created')
self.assertEqual(response.content_type, 'application/json')
self.assertNotIn('transfer_token', response.json['data'])
self.assertIn('transfer', response.json['access'])

# self.set_status('active.auction')
self.set_status('active.auction', {"auctionPeriod": {"startDate": None}, 'status': 'active.tendering'})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ def test_create_tender_complaint(self):
self.assertEqual(complaint['author']['name'], author['name'])
self.assertIn('id', complaint)
self.assertIn(complaint['id'], response.headers['Location'])
self.assertNotIn('transfer_token', complaint)
self.assertIn('transfer', response.json['access'])

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'], self.tender_token),
{"data": {"status": "answered"}},
Expand Down Expand Up @@ -269,6 +271,7 @@ def test_patch_tender_complaint(self):
{"data": {"title": "claim title"}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']["title"], "claim title")
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'], owner_token),
{"data": {"status": "claim"}})
Expand Down Expand Up @@ -427,6 +430,7 @@ def test_get_tender_complaint(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data'], complaint)
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.get('/tenders/{}/complaints/some_id'.format(self.tender_id), status=404)
self.assertEqual(response.status, '404 Not Found')
Expand Down Expand Up @@ -1095,6 +1099,8 @@ def test_create_tender_complaint(self):
self.assertEqual(complaint['author']['name'], author['name'])
self.assertIn('id', complaint)
self.assertIn(complaint['id'], response.headers['Location'])
self.assertNotIn('transfer_token', complaint)
self.assertIn('transfer', response.json['access'])

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'], self.tender_token),
{"data": {"status": "answered"}},
Expand Down Expand Up @@ -1163,6 +1169,7 @@ def test_patch_tender_complaint(self):
{"data": {"title": "claim title"}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']["title"], "claim title")
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'], owner_token),
{"data": {"status": "claim",}})
Expand Down Expand Up @@ -1321,6 +1328,7 @@ def test_get_tender_complaint(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data'], complaint)
self.assertNotIn('transfer_token', response.json['data'])

response = self.app.get('/tenders/{}/complaints/some_id'.format(self.tender_id), status=404)
self.assertEqual(response.status, '404 Not Found')
Expand Down Expand Up @@ -1379,6 +1387,8 @@ def test_create_tender_complaint(self):
self.assertEqual(response.content_type, 'application/json')
complaint = response.json['data']
owner_token = response.json['access']['token']
self.assertIn('transfer', response.json['access'])
self.assertNotIn('transfer_token', complaint)
self.assertEqual(complaint['author']['name'], author['name'])
self.assertIn('id', complaint)
self.assertIn(complaint['id'], response.headers['Location'])
Expand Down Expand Up @@ -1407,6 +1417,7 @@ def test_create_tender_complaint(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.content_type, 'application/json')
self.assertEqual(response.json['data']["status"], "resolved")
self.assertNotIn('transfer_token', complaint)

response = self.app.patch_json('/tenders/{}/complaints/{}?acc_token={}'.format(self.tender_id, complaint['id'], owner_token),
{"data": {"status": "cancelled", "cancellationReason": "reason"}},
Expand Down

0 comments on commit f155374

Please sign in to comment.