From f90bf3dd18cb0bab3ab6c7a0a5d2078c9fd83107 Mon Sep 17 00:00:00 2001 From: Vitalii Martyniak Date: Thu, 26 Mar 2020 07:45:51 +0200 Subject: [PATCH] Rename contract status to `pending.winner-signing` --- src/openprocurement/api/models.py | 2 +- .../belowthreshold/tests/contract_blanks.py | 76 +++++++++---------- .../tender/belowthreshold/views/contract.py | 4 +- .../belowthreshold/views/contract_document.py | 2 +- .../cfaselectionua/tests/contract_blanks.py | 24 +++--- .../tender/cfaselectionua/views/contract.py | 4 +- .../cfaselectionua/views/contract_document.py | 2 +- src/openprocurement/tender/core/validation.py | 6 +- .../tender/openua/views/contract.py | 4 +- .../tender/openua/views/contract_document.py | 2 +- 10 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/openprocurement/api/models.py b/src/openprocurement/api/models.py index 5ba3176854..e966fa48a0 100644 --- a/src/openprocurement/api/models.py +++ b/src/openprocurement/api/models.py @@ -673,7 +673,7 @@ class Contract(Model): description = StringType() # Contract description description_en = StringType() description_ru = StringType() - status = StringType(choices=["pending", "pending.winnerSigning", "terminated", "active", "cancelled"], default="pending") + status = StringType(choices=["pending", "pending.winner-signing", "terminated", "active", "cancelled"], default="pending") period = ModelType(Period) value = ModelType(Value) dateSigned = IsoDateTimeType() diff --git a/src/openprocurement/tender/belowthreshold/tests/contract_blanks.py b/src/openprocurement/tender/belowthreshold/tests/contract_blanks.py index 02cb7676f7..8db7f82eb7 100644 --- a/src/openprocurement/tender/belowthreshold/tests/contract_blanks.py +++ b/src/openprocurement/tender/belowthreshold/tests/contract_blanks.py @@ -560,10 +560,10 @@ def patch_tender_contract_status_by_owner(self): self.app.authorization = ("Basic", ("broker", "")) response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}}, + {"data": {"status": "pending.winner-signing"}}, ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, contract_id, self.tender_token), @@ -604,7 +604,7 @@ def patch_tender_contract_status_by_supplier(self): self.app.authorization = ("Basic", ("broker", "")) response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, contract_id, bid_token), - {"data": {"status": "pending.winnerSigning"}}, + {"data": {"status": "pending.winner-signing"}}, status=403 ) self.assertEqual(response.status, "403 Forbidden") @@ -627,10 +627,10 @@ def patch_tender_contract_status_by_supplier(self): # Tender onwer response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}}, + {"data": {"status": "pending.winner-signing"}}, ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") # Supplier @@ -684,7 +684,7 @@ def patch_tender_contract_status_by_others(self): self.app.authorization = ("Basic", ("broker", "")) response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, contract_id, bid_token), - {"data": {"status": "pending.winnerSigning"}}, + {"data": {"status": "pending.winner-signing"}}, status=403 ) self.assertEqual(response.status, "403 Forbidden") @@ -693,10 +693,10 @@ def patch_tender_contract_status_by_others(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, contract_id, bid_token), @@ -970,10 +970,10 @@ def create_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.post( "/tenders/{}/contracts/{}/documents?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), @@ -1082,10 +1082,10 @@ def create_tender_contract_document_by_supplier(self): # Tender owner response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") # Supplier response = self.app.post( @@ -1191,10 +1191,10 @@ def create_tender_contract_document_by_others(self): # Tender owner response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") # Bid onwer response = self.app.post( @@ -1254,10 +1254,10 @@ def put_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.put( "/tenders/{}/contracts/{}/documents/{}?acc_token={}".format( @@ -1387,10 +1387,10 @@ def put_tender_contract_document_by_supplier(self): # Tender owner response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") # Supplier response = self.app.post( @@ -1517,10 +1517,10 @@ def put_tender_contract_document_by_others(self): # Tender owner response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") # Bid owner response = self.app.post( @@ -1545,10 +1545,10 @@ def patch_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.patch_json( "/tenders/{}/contracts/{}/documents/{}?acc_token={}".format( @@ -1647,10 +1647,10 @@ def patch_tender_contract_document_by_supplier(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.post( "/tenders/{}/contracts/{}/documents?acc_token={}".format(self.tender_id, self.contract_id, bid_token), @@ -1717,10 +1717,10 @@ def patch_tender_contract_document_by_supplier(self): def lot2_create_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.post( "/tenders/{}/contracts/{}/documents?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), @@ -1791,10 +1791,10 @@ def lot2_create_tender_contract_document_by_supplier(self): # Tender owner response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") # Supplier response = self.app.post( @@ -1851,10 +1851,10 @@ def lot2_create_tender_contract_document_by_others(self): # Tender owner response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") # Bid owner response = self.app.post( @@ -1891,10 +1891,10 @@ def lot2_put_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.put( "/tenders/{}/contracts/{}/documents/{}?acc_token={}".format( @@ -1969,10 +1969,10 @@ def lot2_put_tender_contract_document_by_supplier(self): # Tender owner response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") # Supplier response = self.app.post( @@ -2044,10 +2044,10 @@ def lot2_patch_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.patch_json( "/tenders/{}/contracts/{}/documents/{}?acc_token={}".format( @@ -2112,10 +2112,10 @@ def lot2_patch_tender_contract_document_by_supplier(self): # Tender owner response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") # Supplier response = self.app.post( diff --git a/src/openprocurement/tender/belowthreshold/views/contract.py b/src/openprocurement/tender/belowthreshold/views/contract.py index 44909c5a83..1dcccd3955 100644 --- a/src/openprocurement/tender/belowthreshold/views/contract.py +++ b/src/openprocurement/tender/belowthreshold/views/contract.py @@ -83,8 +83,8 @@ def patch(self): contract_status = self.request.context.status apply_patch(self.request, save=False, src=self.request.context.serialize()) if contract_status != self.request.context.status and \ - (contract_status not in ("pending", "pending.winnerSigning",) or \ - self.request.context.status not in ("active", "pending", "pending.winnerSigning",)): + (contract_status not in ("pending", "pending.winner-signing",) or \ + self.request.context.status not in ("active", "pending", "pending.winner-signing",)): raise_operation_error(self.request, "Can't update contract status") if self.request.context.status == "active" and not self.request.context.dateSigned: self.request.context.dateSigned = get_now() diff --git a/src/openprocurement/tender/belowthreshold/views/contract_document.py b/src/openprocurement/tender/belowthreshold/views/contract_document.py index d3019f9713..82d7aaccd9 100644 --- a/src/openprocurement/tender/belowthreshold/views/contract_document.py +++ b/src/openprocurement/tender/belowthreshold/views/contract_document.py @@ -47,7 +47,7 @@ def validate_contract_document(self, operation): ] ): raise_operation_error(self.request, "Can {} document only in active lot status".format(operation)) - if self.request.validated["contract"].status not in ["pending", "pending.winnerSigning", "active"]: + if self.request.validated["contract"].status not in ["pending", "pending.winner-signing", "active"]: raise_operation_error(self.request, "Can't {} document in current contract status".format(operation)) return True diff --git a/src/openprocurement/tender/cfaselectionua/tests/contract_blanks.py b/src/openprocurement/tender/cfaselectionua/tests/contract_blanks.py index 9386d4e32a..f984ed3f5c 100644 --- a/src/openprocurement/tender/cfaselectionua/tests/contract_blanks.py +++ b/src/openprocurement/tender/cfaselectionua/tests/contract_blanks.py @@ -587,10 +587,10 @@ def create_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.post( "/tenders/{}/contracts/{}/documents?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), @@ -718,10 +718,10 @@ def put_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.put( "/tenders/{}/contracts/{}/documents/{}?acc_token={}".format( @@ -840,10 +840,10 @@ def patch_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.patch_json( "/tenders/{}/contracts/{}/documents/{}?acc_token={}".format( @@ -919,10 +919,10 @@ def patch_tender_contract_document(self): def lot2_create_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.post( "/tenders/{}/contracts/{}/documents?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), @@ -995,10 +995,10 @@ def lot2_put_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.put( "/tenders/{}/contracts/{}/documents/{}?acc_token={}".format( @@ -1063,10 +1063,10 @@ def lot2_patch_tender_contract_document(self): response = self.app.patch_json( "/tenders/{}/contracts/{}?acc_token={}".format(self.tender_id, self.contract_id, self.tender_token), - {"data": {"status": "pending.winnerSigning"}} + {"data": {"status": "pending.winner-signing"}} ) self.assertEqual(response.status, "200 OK") - self.assertEqual(response.json["data"]["status"], "pending.winnerSigning") + self.assertEqual(response.json["data"]["status"], "pending.winner-signing") response = self.app.patch_json( "/tenders/{}/contracts/{}/documents/{}?acc_token={}".format( diff --git a/src/openprocurement/tender/cfaselectionua/views/contract.py b/src/openprocurement/tender/cfaselectionua/views/contract.py index 58841b4f07..a795aeda86 100644 --- a/src/openprocurement/tender/cfaselectionua/views/contract.py +++ b/src/openprocurement/tender/cfaselectionua/views/contract.py @@ -81,8 +81,8 @@ def patch(self): contract_status = self.request.context.status apply_patch(self.request, save=False, src=self.request.context.serialize()) if contract_status != self.request.context.status and \ - (contract_status not in ("pending", "pending.winnerSigning",) or \ - self.request.context.status not in ("active", "pending", "pending.winnerSigning",)): + (contract_status not in ("pending", "pending.winner-signing",) or \ + self.request.context.status not in ("active", "pending", "pending.winner-signing",)): raise_operation_error(self.request, "Can't update contract status") if self.request.context.status == "active" and not self.request.context.dateSigned: self.request.context.dateSigned = get_now() diff --git a/src/openprocurement/tender/cfaselectionua/views/contract_document.py b/src/openprocurement/tender/cfaselectionua/views/contract_document.py index 8e818f8759..ff14b3c0e6 100644 --- a/src/openprocurement/tender/cfaselectionua/views/contract_document.py +++ b/src/openprocurement/tender/cfaselectionua/views/contract_document.py @@ -47,7 +47,7 @@ def validate_contract_document(self, operation): ] ): raise_operation_error(self.request, "Can {} document only in active lot status".format(operation)) - if self.request.validated["contract"].status not in ["pending", "pending.winnerSigning", "active"]: + if self.request.validated["contract"].status not in ["pending", "pending.winner-signing", "active"]: raise_operation_error(self.request, "Can't {} document in current contract status".format(operation)) return True diff --git a/src/openprocurement/tender/core/validation.py b/src/openprocurement/tender/core/validation.py index 6ae1b41962..3ba29efa4b 100644 --- a/src/openprocurement/tender/core/validation.py +++ b/src/openprocurement/tender/core/validation.py @@ -1208,7 +1208,7 @@ def validate_complaint_type_change(request): def validate_update_contract_status_by_supplier(request): if request.authenticated_role == "contract_supplier": data = request.validated["data"] - if "status" in data and data["status"] != "pending" or request.context.status != "pending.winnerSigning": + if "status" in data and data["status"] != "pending" or request.context.status != "pending.winner-signing": raise_operation_error(request, "Supplier can change status to `pending`") @@ -1216,12 +1216,12 @@ def validate_role_for_contract_document_operation(request): if request.authenticated_role not in ("tender_owner", "contract_supplier",): raise_operation_error(request, "Can {} document only buyer or supplier".format(OPERATIONS.get(request.method))) if request.authenticated_role == "contract_supplier" and \ - request.validated["contract"].status != "pending.winnerSigning": + request.validated["contract"].status != "pending.winner-signing": raise_operation_error( request, "Supplier can't {} document in current contract status".format(OPERATIONS.get(request.method)) ) if request.authenticated_role == "tender_owner" and \ - request.validated["contract"].status == "pending.winnerSigning": + request.validated["contract"].status == "pending.winner-signing": raise_operation_error( request, "Tender onwer can't {} document in current contract status".format(OPERATIONS.get(request.method)) ) diff --git a/src/openprocurement/tender/openua/views/contract.py b/src/openprocurement/tender/openua/views/contract.py index bf595c7cb8..e0eaa9b236 100644 --- a/src/openprocurement/tender/openua/views/contract.py +++ b/src/openprocurement/tender/openua/views/contract.py @@ -47,8 +47,8 @@ def patch(self): contract_status = self.request.context.status apply_patch(self.request, save=False, src=self.request.context.serialize()) if contract_status != self.request.context.status and \ - (contract_status not in ("pending", "pending.winnerSigning",) or \ - self.request.context.status not in ("active", "pending", "pending.winnerSigning",)): + (contract_status not in ("pending", "pending.winner-signing",) or \ + self.request.context.status not in ("active", "pending", "pending.winner-signing",)): raise_operation_error(self.request, "Can't update contract status") if self.request.context.status == "active" and not self.request.context.dateSigned: self.request.context.dateSigned = get_now() diff --git a/src/openprocurement/tender/openua/views/contract_document.py b/src/openprocurement/tender/openua/views/contract_document.py index 4d77bcafda..b31890aff7 100644 --- a/src/openprocurement/tender/openua/views/contract_document.py +++ b/src/openprocurement/tender/openua/views/contract_document.py @@ -37,7 +37,7 @@ def validate_contract_document(self, operation): ] ): raise_operation_error(self.request, "Can {} document only in active lot status".format(operation)) - if self.request.validated["contract"].status not in ["pending", "pending.winnerSigning", "active"]: + if self.request.validated["contract"].status not in ["pending", "pending.winner-signing", "active"]: raise_operation_error(self.request, "Can't {} document in current contract status".format(operation)) if any( [