From 28cd6c5321b8b3a4f461a808048c0949ca83e293 Mon Sep 17 00:00:00 2001 From: Roman Kozlovskyi Date: Wed, 11 Oct 2017 17:54:56 +0300 Subject: [PATCH 1/4] Fixed auth in tests --- .../tender/openuadefense/tests/award.py | 34 ++++++++++--- .../openuadefense/tests/award_blanks.py | 37 -------------- .../tender/openuadefense/tests/base.py | 8 --- .../openuadefense/tests/cancellation.py | 4 +- .../tender/openuadefense/tests/contract.py | 16 ++++-- .../tender/openuadefense/tests/lot.py | 2 +- .../tender/openuadefense/tests/question.py | 27 +++++++--- .../openuadefense/tests/question_blanks.py | 51 ------------------- .../openuadefense/tests/tender_blanks.py | 7 +-- 9 files changed, 64 insertions(+), 122 deletions(-) delete mode 100644 openprocurement/tender/openuadefense/tests/award_blanks.py delete mode 100644 openprocurement/tender/openuadefense/tests/question_blanks.py diff --git a/openprocurement/tender/openuadefense/tests/award.py b/openprocurement/tender/openuadefense/tests/award.py index e70499f..885dd22 100644 --- a/openprocurement/tender/openuadefense/tests/award.py +++ b/openprocurement/tender/openuadefense/tests/award.py @@ -49,6 +49,7 @@ create_tender_award_complaint, patch_tender_award_complaint, review_tender_award_complaint, + review_tender_award_claim, # TenderLotAwardComplaintResourceTest create_tender_lot_award_complaint, patch_tender_lot_award_complaint, @@ -63,10 +64,6 @@ ) from openprocurement.tender.openuadefense.tests.base import BaseTenderUAContentWebTest -from openprocurement.tender.openuadefense.tests.award_blanks import ( - # TenderAwardComplaintResourceTest - review_tender_award_claim, -) class TenderAwardResourceTest(BaseTenderUAContentWebTest): @@ -109,11 +106,14 @@ def setUp(self): super(TenderAwardComplaintResourceTest, self).setUp() self.bid_token = self.initial_bids_tokens[self.initial_bids[0]['id']] # Create award + auth = self.app.authorization + self.app.authorization = ('Basic', ('token', '')) response = self.app.post_json('/tenders/{}/awards'.format( self.tender_id), {'data': {'suppliers': [test_organization], 'status': 'pending', 'bid_id': self.initial_bids[0]['id']}}) award = response.json['data'] self.award_id = award['id'] self.app.patch_json('/tenders/{}/awards/{}'.format(self.tender_id, self.award_id), {'data': {'status': 'active', "qualified": True, "eligible": True}}) + self.app.authorization = auth test_create_tender_award_complaint_invalid = snitch(create_tender_award_complaint_invalid) test_create_tender_award_claim = snitch(create_tender_award_claim) @@ -136,11 +136,14 @@ def setUp(self): # Create award bid = self.initial_bids[0] self.bid_token = self.initial_bids_tokens[self.initial_bids[0]['id']] + auth = self.app.authorization + self.app.authorization = ('Basic', ('token', '')) response = self.app.post_json('/tenders/{}/awards'.format( self.tender_id), {'data': {'suppliers': [test_organization], 'status': 'pending', 'bid_id': bid['id'], 'lotID': bid['lotValues'][0]['relatedLot']}}) award = response.json['data'] self.award_id = award['id'] self.app.patch_json('/tenders/{}/awards/{}'.format(self.tender_id, self.award_id), {'data': {'status': 'active', "qualified": True, "eligible": True}}) + self.app.authorization = auth test_create_tender_award_complaint = snitch(create_tender_lot_award_complaint) test_patch_tender_award_complaint = snitch(patch_tender_lot_award_complaint) @@ -162,14 +165,19 @@ class TenderAwardComplaintDocumentResourceTest(BaseTenderUAContentWebTest): def setUp(self): super(TenderAwardComplaintDocumentResourceTest, self).setUp() # Create award + auth = self.app.authorization + self.app.authorization = ('Basic', ('token', '')) response = self.app.post_json('/tenders/{}/awards'.format( self.tender_id), {'data': {'suppliers': [test_organization], 'status': 'pending', 'bid_id': self.initial_bids[0]['id']}}) award = response.json['data'] self.award_id = award['id'] self.app.patch_json('/tenders/{}/awards/{}'.format(self.tender_id, self.award_id), {'data': {'status': 'active', "qualified": True, "eligible": True}}) + self.app.authorization = auth + # Create complaint for award - response = self.app.post_json('/tenders/{}/awards/{}/complaints'.format( - self.tender_id, self.award_id), {'data': {'title': 'complaint title', 'description': 'complaint description', 'author': test_organization}}) + bid_token = self.initial_bids_tokens[self.initial_bids[0]['id']] + response = self.app.post_json('/tenders/{}/awards/{}/complaints?acc_token={}'.format( + self.tender_id, self.award_id, bid_token), {'data': {'title': 'complaint title', 'description': 'complaint description', 'author': test_organization}}) complaint = response.json['data'] self.complaint_id = complaint['id'] self.complaint_owner_token = response.json['access']['token'] @@ -189,14 +197,18 @@ def setUp(self): super(Tender2LotAwardComplaintDocumentResourceTest, self).setUp() # Create award bid = self.initial_bids[0] + bid_token = self.initial_bids_tokens[self.initial_bids[0]['id']] + auth = self.app.authorization + self.app.authorization = ('Basic', ('token', '')) response = self.app.post_json('/tenders/{}/awards'.format( self.tender_id), {'data': {'suppliers': [test_organization], 'status': 'pending', 'bid_id': bid['id'], 'lotID': bid['lotValues'][0]['relatedLot']}}) award = response.json['data'] self.award_id = award['id'] self.app.patch_json('/tenders/{}/awards/{}'.format(self.tender_id, self.award_id), {'data': {'status': 'active', "qualified": True, "eligible": True}}) + self.app.authorization = auth # Create complaint for award - response = self.app.post_json('/tenders/{}/awards/{}/complaints'.format( - self.tender_id, self.award_id), {'data': {'title': 'complaint title', 'description': 'complaint description', 'author': test_organization}}) + response = self.app.post_json('/tenders/{}/awards/{}/complaints?acc_token={}'.format( + self.tender_id, self.award_id, bid_token), {'data': {'title': 'complaint title', 'description': 'complaint description', 'author': test_organization}}) complaint = response.json['data'] self.complaint_id = complaint['id'] self.complaint_owner_token = response.json['access']['token'] @@ -213,10 +225,13 @@ class TenderAwardDocumentResourceTest(BaseTenderUAContentWebTest, TenderAwardDoc def setUp(self): super(TenderAwardDocumentResourceTest, self).setUp() # Create award + auth = self.app.authorization + self.app.authorization = ('Basic', ('token', '')) response = self.app.post_json('/tenders/{}/awards'.format( self.tender_id), {'data': {'suppliers': [test_organization], 'status': 'pending', 'bid_id': self.initial_bids[0]['id']}}) award = response.json['data'] self.award_id = award['id'] + self.app.authorization = auth class Tender2LotAwardDocumentResourceTest(BaseTenderUAContentWebTest): @@ -228,10 +243,13 @@ def setUp(self): super(Tender2LotAwardDocumentResourceTest, self).setUp() # Create award bid = self.initial_bids[0] + auth = self.app.authorization + self.app.authorization = ('Basic', ('token', '')) response = self.app.post_json('/tenders/{}/awards'.format( self.tender_id), {'data': {'suppliers': [test_organization], 'status': 'pending', 'bid_id': bid['id'], 'lotID': bid['lotValues'][0]['relatedLot']}}) award = response.json['data'] self.award_id = award['id'] + self.app.authorization = auth test_create_tender_award_document = snitch(create_tender_lots_award_document) test_put_tender_award_document = snitch(put_tender_lots_award_document) diff --git a/openprocurement/tender/openuadefense/tests/award_blanks.py b/openprocurement/tender/openuadefense/tests/award_blanks.py deleted file mode 100644 index 523be6c..0000000 --- a/openprocurement/tender/openuadefense/tests/award_blanks.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- -from openprocurement.tender.belowthreshold.tests.base import test_organization - - -# TenderAwardComplaintResourceTest - -def review_tender_award_claim(self): - for status in ['invalid', 'resolved', 'declined']: - #self.app.authorization = ('Basic', ('token', '')) - response = self.app.post_json('/tenders/{}/awards/{}/complaints'.format(self.tender_id, self.award_id), {'data': { - 'title': 'complaint title', - 'description': 'complaint description', - 'author': test_organization, - 'status': 'claim' - }}) - self.assertEqual(response.status, '201 Created') - self.assertEqual(response.content_type, 'application/json') - complaint = response.json['data'] - complaint_token = response.json['access']['token'] - - #self.app.authorization = ('Basic', ('broker', '')) - response = self.app.patch_json('/tenders/{}/awards/{}/complaints/{}?acc_token={}'.format(self.tender_id, self.award_id, complaint['id'], self.tender_token), {"data": { - "status": "answered", - "resolutionType": status, - "resolution": "resolution text for {} status".format(status) - }}) - self.assertEqual(response.status, '200 OK') - self.assertEqual(response.content_type, 'application/json') - self.assertEqual(response.json['data']["resolutionType"], status) - - #self.app.authorization = ('Basic', ('token', '')) - response = self.app.patch_json('/tenders/{}/awards/{}/complaints/{}?acc_token={}'.format(self.tender_id, self.award_id, complaint['id'], complaint_token), {"data": { - "satisfied": 'i' in status, - }}) - self.assertEqual(response.status, '200 OK') - self.assertEqual(response.content_type, 'application/json') - self.assertEqual(response.json['data']["satisfied"], 'i' in status) diff --git a/openprocurement/tender/openuadefense/tests/base.py b/openprocurement/tender/openuadefense/tests/base.py index 945e8d7..6fd2e4a 100644 --- a/openprocurement/tender/openuadefense/tests/base.py +++ b/openprocurement/tender/openuadefense/tests/base.py @@ -101,14 +101,6 @@ def go_to_enquiryPeriod_end(self): } }) - def setUp(self): - super(BaseTenderWebTest, self).setUp() - self.app.authorization = ('Basic', ('token', '')) - self.couchdb_server = self.app.app.registry.couchdb_server - self.db = self.app.app.registry.db - if self.docservice: - self.setUpDS() - def set_status(self, status, extra=None): data = {'status': status} if status == 'active.tendering': diff --git a/openprocurement/tender/openuadefense/tests/cancellation.py b/openprocurement/tender/openuadefense/tests/cancellation.py index 02039fd..6855a19 100644 --- a/openprocurement/tender/openuadefense/tests/cancellation.py +++ b/openprocurement/tender/openuadefense/tests/cancellation.py @@ -48,8 +48,8 @@ class TenderCancellationDocumentResourceTest(BaseTenderUAContentWebTest,TenderCa def setUp(self): super(TenderCancellationDocumentResourceTest, self).setUp() # Create cancellation - response = self.app.post_json('/tenders/{}/cancellations'.format( - self.tender_id), {'data': {'reason': 'cancellation reason'}}) + response = self.app.post_json('/tenders/{}/cancellations?acc_token={}'.format( + self.tender_id, self.tender_token), {'data': {'reason': 'cancellation reason'}}) cancellation = response.json['data'] self.cancellation_id = cancellation['id'] diff --git a/openprocurement/tender/openuadefense/tests/contract.py b/openprocurement/tender/openuadefense/tests/contract.py index b254be4..db568d8 100644 --- a/openprocurement/tender/openuadefense/tests/contract.py +++ b/openprocurement/tender/openuadefense/tests/contract.py @@ -28,12 +28,19 @@ class TenderContractResourceTest(BaseTenderUAContentWebTest, TenderContractResou def setUp(self): super(TenderContractResourceTest, self).setUp() # Create award + authorization = self.app.authorization + self.app.authorization = ('Basic', ('token', '')) response = self.app.post_json('/tenders/{}/awards'.format( - self.tender_id), {'data': {'suppliers': [test_organization], 'status': 'pending', 'bid_id': self.initial_bids[0]['id'], - 'value': self.initial_bids[0]['value']}}) + self.tender_id), + {'data': {'suppliers': [test_organization], 'status': 'pending', 'bid_id': self.initial_bids[0]['id'], + 'value': self.initial_bids[0]['value']}}) award = response.json['data'] self.award_id = award['id'] - response = self.app.patch_json('/tenders/{}/awards/{}'.format(self.tender_id, self.award_id), {"data": {"status": "active", "qualified": True, "eligible": True}}) + self.award_value = award['value'] + self.app.authorization = authorization + self.app.patch_json( + '/tenders/{}/awards/{}?acc_token={}'.format(self.tender_id, self.award_id, self.tender_token), + {"data": {"status": "active", "qualified": True, "eligible": True}}) test_create_tender_contract = snitch(create_tender_contract) test_patch_tender_contract = snitch(patch_tender_contract) @@ -46,6 +53,8 @@ class TenderContractDocumentResourceTest(BaseTenderUAContentWebTest, TenderContr def setUp(self): super(TenderContractDocumentResourceTest, self).setUp() # Create award + auth = self.app.authorization + self.app.authorization = ('Basic', ('token', '')) response = self.app.post_json('/tenders/{}/awards'.format( self.tender_id), {'data': {'suppliers': [test_organization], 'status': 'pending', 'bid_id': self.initial_bids[0]['id']}}) award = response.json['data'] @@ -55,6 +64,7 @@ def setUp(self): response = self.app.post_json('/tenders/{}/contracts'.format(self.tender_id), {'data': {'title': 'contract title', 'description': 'contract description', 'awardID': self.award_id}}) contract = response.json['data'] self.contract_id = contract['id'] + self.app.authorization = auth def suite(): diff --git a/openprocurement/tender/openuadefense/tests/lot.py b/openprocurement/tender/openuadefense/tests/lot.py index e087d2a..3a8f6e4 100644 --- a/openprocurement/tender/openuadefense/tests/lot.py +++ b/openprocurement/tender/openuadefense/tests/lot.py @@ -80,7 +80,7 @@ class TenderLotFeatureBidderResourceTest(BaseTenderUAContentWebTest): def setUp(self): super(TenderLotFeatureBidderResourceTest, self).setUp() self.lot_id = self.initial_lots[0]['id'] - response = self.app.patch_json('/tenders/{}'.format(self.tender_id), {"data": { + response = self.app.patch_json('/tenders/{}?acc_token={}'.format(self.tender_id, self.tender_token), {"data": { "items": [ { 'relatedLot': self.lot_id, diff --git a/openprocurement/tender/openuadefense/tests/question.py b/openprocurement/tender/openuadefense/tests/question.py index 81ee339..e03a8b5 100644 --- a/openprocurement/tender/openuadefense/tests/question.py +++ b/openprocurement/tender/openuadefense/tests/question.py @@ -12,18 +12,19 @@ patch_tender_question, # TenderLotQuestionResourceTest lot_create_tender_question, + lot_patch_tender_question, ) from openprocurement.tender.openua.tests.question_blanks import ( # TenderQuestionResourceTest create_tender_question, + # TenderLotQuestionResourceTest + tender_has_unanswered_questions, + lot_has_unanswered_questions, + item_has_unanswered_questions, ) from openprocurement.tender.openuadefense.tests.base import BaseTenderUAContentWebTest -from openprocurement.tender.openuadefense.tests.question_blanks import ( - # TenderLotQuestionResourceTest - patch_multilot_tender_question, -) class TenderQuestionResourceTest(BaseTenderUAContentWebTest, TenderQuestionResourceTestMixin): @@ -37,8 +38,22 @@ class TenderLotQuestionResourceTest(BaseTenderUAContentWebTest): initial_lots = 2 * test_lots author_data = test_organization - test_create_tender_question = snitch(lot_create_tender_question) - test_patch_tender_question = snitch(patch_multilot_tender_question) + def create_question_for(self, questionOf, relatedItem): + response = self.app.post_json('/tenders/{}/questions'.format(self.tender_id), {'data': { + 'title': 'question title', + 'description': 'question description', + "questionOf": questionOf, + "relatedItem": relatedItem, + 'author': test_organization + }}) + self.assertEqual(response.status, '201 Created') + return response.json['data']['id'] + + test_create_tender_lot_question = snitch(lot_create_tender_question) + test_patch_tender_lot_question = snitch(lot_patch_tender_question) + test_tender_has_unanswered_questions = snitch(tender_has_unanswered_questions) + test_lot_has_unanswered_questions = snitch(lot_has_unanswered_questions) + test_item_has_unanswered_questions = snitch(item_has_unanswered_questions) def suite(): diff --git a/openprocurement/tender/openuadefense/tests/question_blanks.py b/openprocurement/tender/openuadefense/tests/question_blanks.py deleted file mode 100644 index a8073c0..0000000 --- a/openprocurement/tender/openuadefense/tests/question_blanks.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -from openprocurement.tender.belowthreshold.tests.base import test_organization - -# TenderLotQuestionResourceTest - - -def patch_multilot_tender_question(self): - response = self.app.post_json('/tenders/{}/questions'.format(self.tender_id), {'data': { - 'title': 'question title', - 'description': 'question description', - "questionOf": "lot", - "relatedItem": self.initial_lots[0]['id'], - 'author': test_organization - }}) - self.assertEqual(response.status, '201 Created') - self.assertEqual(response.content_type, 'application/json') - question = response.json['data'] - - response = self.app.post_json('/tenders/{}/cancellations'.format(self.tender_id), {'data': { - 'reason': 'cancellation reason', - 'status': 'active', - "cancellationOf": "lot", - "relatedLot": self.initial_lots[0]['id'] - }}) - self.assertEqual(response.status, '201 Created') - - response = self.app.patch_json('/tenders/{}/questions/{}'.format(self.tender_id, question['id']), {"data": {"answer": "answer"}}, status=403) - self.assertEqual(response.status, '403 Forbidden') - self.assertEqual(response.content_type, 'application/json') - self.assertEqual(response.json['errors'][0]["description"], "Can update question only in active lot status") - - response = self.app.post_json('/tenders/{}/questions'.format(self.tender_id), {'data': { - 'title': 'question title', - 'description': 'question description', - "questionOf": "lot", - "relatedItem": self.initial_lots[1]['id'], - 'author': test_organization - }}) - self.assertEqual(response.status, '201 Created') - self.assertEqual(response.content_type, 'application/json') - question = response.json['data'] - - response = self.app.patch_json('/tenders/{}/questions/{}'.format(self.tender_id, question['id']), {"data": {"answer": "answer"}}) - self.assertEqual(response.status, '200 OK') - self.assertEqual(response.content_type, 'application/json') - self.assertEqual(response.json['data']["answer"], "answer") - - response = self.app.get('/tenders/{}/questions/{}'.format(self.tender_id, question['id'])) - self.assertEqual(response.status, '200 OK') - self.assertEqual(response.content_type, 'application/json') - self.assertEqual(response.json['data']["answer"], "answer") diff --git a/openprocurement/tender/openuadefense/tests/tender_blanks.py b/openprocurement/tender/openuadefense/tests/tender_blanks.py index 3f79372..1eebf1a 100644 --- a/openprocurement/tender/openuadefense/tests/tender_blanks.py +++ b/openprocurement/tender/openuadefense/tests/tender_blanks.py @@ -307,17 +307,12 @@ def patch_tender(self): self.assertEqual(response.content_type, 'application/json') self.assertNotEqual(response.json['data']['status'], 'cancelled') - response = self.app.patch_json('/tenders/{}'.format(tender['id']), {'data': {'status': 'cancelled'}}) - self.assertEqual(response.status, '200 OK') - self.assertEqual(response.content_type, 'application/json') - self.assertNotEqual(response.json['data']['status'], 'cancelled') - response = self.app.patch_json('/tenders/{}?acc_token={}'.format(tender['id'], owner_token), {'data': {'procuringEntity': {'kind': 'general'}}}) self.assertEqual(response.status, '200 OK') self.assertEqual(response.content_type, 'application/json') self.assertNotEqual(response.json['data']['procuringEntity']['kind'], 'general') - response = self.app.patch_json('/tenders/{}'.format(tender['id']), + response = self.app.patch_json('/tenders/{}?acc_token={}'.format(tender['id'], owner_token), {'data': {'tenderPeriod': {'startDate': tender['enquiryPeriod']['endDate']}}}, status=422 ) From 07467b5f2a6d3a98eac0108c18562e3d2de46a4e Mon Sep 17 00:00:00 2001 From: Roman Kozlovskyi Date: Wed, 11 Oct 2017 17:59:40 +0300 Subject: [PATCH 2/4] Fixed buildout --- buildout.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildout.cfg b/buildout.cfg index 2554ab8..61d8901 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -8,10 +8,10 @@ find-links = http://op:x9W3jZ@dist.quintagroup.com/op/ auto-checkout = openprocurement.api openprocurement.tender.core openprocurement.tender.belowthreshold openprocurement.tender.openua [sources] -openprocurement.api = git https://github.com/openprocurement/openprocurement.api.git branch=a258001251842882_refactoring -openprocurement.tender.core = git https://github.com/openprocurement/openprocurement.tender.core.git branch=master -openprocurement.tender.belowthreshold = git https://github.com/openprocurement/openprocurement.tender.belowthreshold.git branch=master -openprocurement.tender.openua = git https://github.com/openprocurement/openprocurement.tender.openua.git branch=a258001251842882_refactoring +openprocurement.api = git https://github.com/openprocurement/openprocurement.api.git branch=production +openprocurement.tender.core = git https://github.com/openprocurement/openprocurement.tender.core.git branch=production +openprocurement.tender.belowthreshold = git https://github.com/openprocurement/openprocurement.tender.belowthreshold.git branch=production +openprocurement.tender.openua = git https://github.com/openprocurement/openprocurement.tender.openua.git branch=production [test] From ca97a24d015a4c5602560ed44c16417a72164944 Mon Sep 17 00:00:00 2001 From: Roman Kozlovskyi Date: Wed, 11 Oct 2017 18:11:42 +0300 Subject: [PATCH 3/4] Fixed buildout --- buildout.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildout.cfg b/buildout.cfg index 61d8901..7e9ef41 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -5,14 +5,14 @@ parts = test develop = . extensions = mr.developer find-links = http://op:x9W3jZ@dist.quintagroup.com/op/ -auto-checkout = openprocurement.api openprocurement.tender.core openprocurement.tender.belowthreshold openprocurement.tender.openua +auto-checkout = openprocurement.api openprocurement.tender.core openprocurement.tender.belowthreshold openprocurement.tender.openua barbecue [sources] openprocurement.api = git https://github.com/openprocurement/openprocurement.api.git branch=production openprocurement.tender.core = git https://github.com/openprocurement/openprocurement.tender.core.git branch=production openprocurement.tender.belowthreshold = git https://github.com/openprocurement/openprocurement.tender.belowthreshold.git branch=production openprocurement.tender.openua = git https://github.com/openprocurement/openprocurement.tender.openua.git branch=production - +barbecue = git https://github.com/openprocurement/barbecue.git branch=production [test] recipe = zc.recipe.egg:scripts From e94633cfd2a4c0afe52bf8076617a036c5a2c0db Mon Sep 17 00:00:00 2001 From: Dmitriy Belyaev Date: Tue, 10 Oct 2017 17:14:41 +0300 Subject: [PATCH 4/4] reviewer status transition stopping->satisfied, pending->stopped --- buildout.cfg | 2 +- docs/source/complaints.rst | 8 ++++---- openprocurement/tender/openuadefense/tests/award.py | 2 ++ openprocurement/tender/openuadefense/views/complaint.py | 7 ++----- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/buildout.cfg b/buildout.cfg index 7e9ef41..20134c9 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -11,7 +11,7 @@ auto-checkout = openprocurement.api openprocurement.tender.core openprocurement. openprocurement.api = git https://github.com/openprocurement/openprocurement.api.git branch=production openprocurement.tender.core = git https://github.com/openprocurement/openprocurement.tender.core.git branch=production openprocurement.tender.belowthreshold = git https://github.com/openprocurement/openprocurement.tender.belowthreshold.git branch=production -openprocurement.tender.openua = git https://github.com/openprocurement/openprocurement.tender.openua.git branch=production +openprocurement.tender.openua = git https://github.com/openprocurement/openprocurement.tender.openua.git branch=a433718495997911_satisfy_stopping_complaint barbecue = git https://github.com/openprocurement/barbecue.git branch=production [test] diff --git a/docs/source/complaints.rst b/docs/source/complaints.rst index 7f92dbf..ce2bc97 100644 --- a/docs/source/complaints.rst +++ b/docs/source/complaints.rst @@ -38,8 +38,8 @@ Tender Conditions Claims/Complaints {pending,accepted} -> stopping; edge[style=bold]; accepted -> {declined,satisfied,stopped}; - pending -> {accepted,invalid}; - stopping -> {stopped,invalid,declined}; + pending -> {accepted,invalid,stopped}; + stopping -> {stopped,invalid,declined,satisfied}; {pending;stopping} -> mistaken; edge[label="auction" style=dotted]; answered -> {declined,resolved,invalid}; @@ -74,8 +74,8 @@ Tender Award Claims/Complaints pending -> stopping; accepted -> stopping; edge[style=bold]; - pending -> {accepted,invalid}; - stopping -> {stopped,invalid,declined}; + pending -> {accepted,invalid,stopped}; + stopping -> {stopped,invalid,declined,satisfied}; accepted -> {declined,satisfied,stopped}; {pending;stopping} -> mistaken; } diff --git a/openprocurement/tender/openuadefense/tests/award.py b/openprocurement/tender/openuadefense/tests/award.py index 885dd22..dddc9a3 100644 --- a/openprocurement/tender/openuadefense/tests/award.py +++ b/openprocurement/tender/openuadefense/tests/award.py @@ -50,6 +50,7 @@ patch_tender_award_complaint, review_tender_award_complaint, review_tender_award_claim, + review_tender_award_stopping_complaint, # TenderLotAwardComplaintResourceTest create_tender_lot_award_complaint, patch_tender_lot_award_complaint, @@ -121,6 +122,7 @@ def setUp(self): test_create_tender_award_complaint = snitch(create_tender_award_complaint) test_patch_tender_award_complaint = snitch(patch_tender_award_complaint) test_review_tender_award_complaint = snitch(review_tender_award_complaint) + test_review_tender_award_stopping_complaint = snitch(review_tender_award_stopping_complaint) test_review_tender_award_claim = snitch(review_tender_award_claim) test_get_tender_award_complaint = snitch(get_tender_award_complaint) test_get_tender_award_complaints = snitch(get_tender_award_complaints) diff --git a/openprocurement/tender/openuadefense/views/complaint.py b/openprocurement/tender/openuadefense/views/complaint.py index 1a6cec7..9c3a6cd 100644 --- a/openprocurement/tender/openuadefense/views/complaint.py +++ b/openprocurement/tender/openuadefense/views/complaint.py @@ -134,13 +134,10 @@ def patch(self): apply_patch(self.request, save=False, src=self.context.serialize()) self.context.dateAccepted = get_now() self.context.acceptance = True - elif self.request.authenticated_role == 'aboveThresholdReviewers' and self.context.status == 'accepted' and data.get('status', self.context.status) in ['declined', 'satisfied']: + elif self.request.authenticated_role == 'aboveThresholdReviewers' and self.context.status in ['accepted', 'stopping'] and data.get('status', self.context.status) in ['declined', 'satisfied']: apply_patch(self.request, save=False, src=self.context.serialize()) self.context.dateDecision = get_now() - elif self.request.authenticated_role == 'aboveThresholdReviewers' and self.context.status == 'stopping' and data.get('status', self.context.status) == 'declined': - apply_patch(self.request, save=False, src=self.context.serialize()) - self.context.dateDecision = get_now() - elif self.request.authenticated_role == 'aboveThresholdReviewers' and self.context.status in ['accepted', 'stopping'] and data.get('status', self.context.status) == 'stopped': + elif self.request.authenticated_role == 'aboveThresholdReviewers' and self.context.status in ['pending', 'accepted', 'stopping'] and data.get('status', self.context.status) == 'stopped': apply_patch(self.request, save=False, src=self.context.serialize()) self.context.dateDecision = get_now() self.context.dateCanceled = self.context.dateCanceled or get_now()