Skip to content

Commit

Permalink
Fix tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
yshalenyk committed May 22, 2020
1 parent 326ff6f commit 513456f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 81 deletions.
56 changes: 0 additions & 56 deletions src/openprocurement/tender/pricequotation/configure.zcml

This file was deleted.

2 changes: 1 addition & 1 deletion src/openprocurement/tender/pricequotation/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def generate_bids(self, status, startend):
tenderPeriod_startDate = self.now + self.periods[status][startend]["tenderPeriod"]["startDate"]
bids = self.tender_document.get("bids", [])
# import pdb; pdb.set_trace()
if self.initial_bids or not bids:
if self.initial_bids and not bids:
self.tender_document_patch["bids"] = []
self.initial_bids_tokens = []
for position, bid in enumerate(test_bids):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1750,14 +1750,11 @@ def invalid_tender_conditions(self):
def one_valid_bid_tender(self):
tender_id = self.tender_id
owner_token = self.tender_token
# switch to active.tendering
response = self.set_status(
"active.tendering"
)
# create bid
self.app.authorization = ("Basic", ("broker", ""))
self.app.post_json(
"/tenders/{}/bids".format(tender_id), {"data": {"tenderers": [test_organization], "value": {"amount": 500}, "requirementResponses": test_requirement_response_valid}}
"/tenders/{}/bids".format(tender_id),
{"data": {"tenderers": [test_organization], "value": {"amount": 500}, "requirementResponses": test_requirement_response_valid}}
)
# switch to active.qualification
self.set_status("active.qualification")
Expand Down
20 changes: 11 additions & 9 deletions src/openprocurement/tender/pricequotation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
from logging import getLogger
from openprocurement.api.constants import RELEASE_2020_04_19
from openprocurement.api.utils import get_now, context_unpack
from openprocurement.tender.core.utils import (
remove_draft_bids,
cancel_tender
)

from openprocurement.tender.core.utils import remove_draft_bids
from openprocurement.tender.core.utils import get_first_revision_date


Expand All @@ -25,7 +21,7 @@ def check_bids(request):
add_next_award(request)


def add_contract(request, award, now=None):
def add_contract(request, award, now=None):
tender = request.validated["tender"]
tender.contracts.append(
type(tender).contracts.model_class(
Expand All @@ -49,15 +45,21 @@ def generate_contract_value(tender, award):
return None


def check_cancellation_status(request, cancel_tender_method=cancel_tender):
def cancel_tender(request):
tender = request.validated["tender"]
if tender.status in ["active.tendering"]:
tender.bids = []
tender.status = "cancelled"


def check_cancellation_status(request):
tender = request.validated["tender"]
cancellations = tender.cancellations

for cancellation in cancellations:
if cancellation.status == "pending":
cancellation.status = "active"
if cancellation.cancellationOf == "tender":
cancel_tender_method(request)
cancel_tender(request)


def check_status(request):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
validate_tender_not_in_terminated_status,
validate_cancellation_data,
validate_patch_cancellation_data,
validate_cancellation_statuses_without_complaints
)
from openprocurement.tender.pricequotation.utils import cancel_tender
from openprocurement.tender.pricequotation.constants import PMT


Expand All @@ -37,7 +37,7 @@ def collection_post(self):
cancellation.date = get_now()

if cancellation.status == "active":
self.cancel_tender_method(self.request)
cancel_tender(self.request)

self.request.context.cancellations.append(cancellation)
if save_tender(self.request):
Expand All @@ -60,7 +60,6 @@ def collection_post(self):
validators=(
validate_tender_not_in_terminated_status,
validate_patch_cancellation_data,
validate_cancellation_statuses_without_complaints,
),
permission="edit_cancellation"
)
Expand All @@ -69,7 +68,7 @@ def patch(self):
apply_patch(self.request, save=False, src=cancellation.serialize())

if cancellation.status == "active":
self.cancel_tender_method(self.request)
cancel_tender(self.request)

if save_tender(self.request):
self.LOGGER.info(
Expand Down
10 changes: 4 additions & 6 deletions src/openprocurement/tender/pricequotation/views/tender.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
from openprocurement.api.utils import context_unpack, json_view
from openprocurement.tender.core.utils import\
save_tender, optendersresource, apply_patch
from openprocurement.tender.core.validation import (
validate_tender_not_in_terminated_status,
validate_tender_change_status_permission,
)
from openprocurement.tender.core.validation import\
validate_tender_not_in_terminated_status

from openprocurement.tender.belowthreshold.views.tender import TenderResource
from openprocurement.tender.pricequotation.constants import PMT
from openprocurement.tender.pricequotation.utils import check_status
from openprocurement.tender.pricequotation.validation import validate_patch_tender_data
from openprocurement.tender.pricequotation.validation import\
validate_patch_tender_data


@optendersresource(
Expand All @@ -27,7 +26,6 @@ class PriceQuotationTenderResource(TenderResource):
validators=(
validate_patch_tender_data,
validate_tender_not_in_terminated_status,
validate_tender_change_status_permission,
),
permission="edit_tender",
)
Expand Down

0 comments on commit 513456f

Please sign in to comment.