コード例 #1
0
def check_award_status(request, award, now):
    """Checking admission protocol loading by the owner in time."""
    auction = request.validated['auction']
    admission_protocol_overdue = admission_overdue_predicate(award, 'pending.admission', now)

    if admission_protocol_overdue:
        set_unsuccessful_award(request, auction, award, now)
コード例 #2
0
def check_award_status(request, award, now):
    """Checking required documents loading and payment recieving in time."""
    auction = request.validated['auction']
    protocol_overdue = protocol_overdue_predicate(award,
                                                  'pending.verification', now)
    contract_overdue = contract_overdue_predicate(award, 'active', now)
    payment_overdue = (award.status == 'pending.payment'
                       and award['paymentPeriod']['endDate'] < now)
    if protocol_overdue or contract_overdue or payment_overdue:
        set_unsuccessful_award(request, auction, award, now)
コード例 #3
0
def check_award_status(request, award, now):
    """Checking protocol and contract loading by the owner in time."""
    auction = request.validated['auction']
    protocol_overdue = protocol_overdue_predicate(award, 'pending', now)
    # seek for contract overdue
    related_contract = get_related_contract_of_award(award['id'], auction)
    contract_overdue = contract_overdue_predicate(
        related_contract, 'pending', now) if related_contract else None

    if protocol_overdue or contract_overdue:
        set_unsuccessful_award(request, auction, award, now)
コード例 #4
0
    def test_unsuccessful_award(self):
        contract_status = 'status'
        need_status = 'active'
        need_award_id = uuid.uuid4().hex
        differ_id = uuid.uuid4().hex
        complain_end_date = get_now()
        end_data_award = munch.Munch({'endDate': True})
        end_data_action = munch.Munch({'endDate': True})

        contract = munch.Munch({
            'awardID': need_award_id,
            'status': contract_status
        })

        auction = munch.Munch({
            'status': True,
            'awardPeriod': end_data_action,
            'contracts': [contract]
        })

        award = munch.Munch({
            'id': need_award_id,
            'status': need_status,
            'complaintPeriod': end_data_award
        })
        request = mock.MagicMock()

        set_unsuccessful_award(request, auction, award, complain_end_date)
        self.assertEqual(
            1, request.content_configurator.back_to_awarding.call_count)
        self.assertEqual(contract.status, 'cancelled')
        self.assertEqual(auction.status, 'active.qualification')
        self.assertEqual(auction.awardPeriod.endDate, None)
        self.assertEqual(award.status, 'unsuccessful')
        self.assertEqual(award.complaintPeriod.endDate.isoformat(),
                         end_data_award.endDate.isoformat())

        award.status = 'not_active'
        auction.awardPeriod.endDate = True
        auction.status = 'not_changed'
        contract.status = 'not_cancelled'
        set_unsuccessful_award(request, auction, award, complain_end_date)
        self.assertEqual(auction.awardPeriod.endDate, True)
        self.assertEqual(auction.status, 'not_changed')
        self.assertEqual(contract.status, 'not_cancelled')
        self.assertEqual(
            2, request.content_configurator.back_to_awarding.call_count)

        award.status = 'active'
        award.id = differ_id
        set_unsuccessful_award(request, auction, award, complain_end_date)
        self.assertEqual(contract.status, 'not_cancelled')
        self.assertEqual(auction.status, 'active.qualification')
        self.assertEqual(auction.awardPeriod.endDate, None)