Commit 63b3661e authored by Viacheslav Sukhovieiev's avatar Viacheslav Sukhovieiev
Browse files

fix(DGF): add weekend validation for prolongation

parent 05941401
......@@ -29,10 +29,25 @@ holidays:
- 2021-10-14
- 2021-10-15
- 2021-12-27
- 2022-01-03
- 2022-01-07
- 2022-03-07
- 2022-03-08
- 2022-04-25
- 2022-05-02
- 2022-05-09
- 2022-06-13
- 2022-06-27
- 2022-06-28
- 2022-08-24
- 2022-10-14
- 2022-12-26
working_days:
- 2020-01-11
- 2021-01-16
- 2021-08-28
- 2021-10-23
- 2022-03-12
- 2022-07-02
timezone: 'Europe/Kiev'
\ No newline at end of file
timezone: 'Europe/Kiev'
......@@ -43,7 +43,8 @@ MONTH_NAMES = [
def get_date_config():
"""
>>> days = get_date_config()['working_days']
>>> days == {date(2020, 1, 11), date(2021, 1, 16), date(2021, 8, 28), date(2021, 10, 23)}
>>> days == {date(2020, 1, 11), date(2021, 1, 16), date(2021, 8, 28), date(2021, 10, 23),
... date(2022, 3, 12), date(2022, 7, 2)}
True
"""
global DATE_CONFIG, DAYS_OF_WEEK, MONTH_NAMES
......
......@@ -18,6 +18,10 @@ class CheckProlongationMixin:
def _check_prolongation_term(self, prolongation_obj, limit):
if date := prolongation_obj.get('prolongationTerm', None):
self._check_qualification_start(date, 'prolongationTerm')
if not calculator.is_business_day(date):
raise errors.DataError({
'prolongationTerm': 'Prolongation must be only on business day'
})
if calculator.get_business_days_diff_len(self.qualificationPeriod.startDate, date) > limit:
raise errors.DataError({
'prolongationTerm': f'Cannot be > procedure.qualificationPeriod.startDate for {limit} business days'
......
import os
import pytest
import datetime
from datetime import datetime
FIXTURE_PROCEDURE = os.path.join('dgf', 'dutch', 'procedure.json')
......@@ -28,7 +28,8 @@ def get_raw_prolongation(get_fixture_by_name):
def _get_raw_prolongation(date=None):
prolongation = get_fixture_by_name(PROLONGATION)
if date:
prolongation['datePublished'] = date
prolongation['datePublished'] = datetime.now().isoformat()
prolongation['prolongationDate'] = date
else:
prolongation['prolongationDate'] = datetime.now().isoformat()
return prolongation
return _get_raw_prolongation
......@@ -1090,40 +1090,43 @@ class TestDgfActiveAwarded:
self, procedure, create_procedure, get_procedure, get_raw_prolongation, send_request, bid,
create_bid, set_bid_status, set_procedure_status
):
procedure_id, procedure_acc_token = await create_procedure(procedure)
bid_id_1, bid_token_1 = await create_bid(procedure_id, bid)
await set_bid_status(procedure_id, bid_id_1, bid_token_1, 'active')
bid_id_2, bid_token_2 = await create_bid(procedure_id, bid)
await set_bid_status(procedure_id, bid_id_2, bid_token_2, 'active')
await set_procedure_status(procedure_id, 'active_awarded')
proc = await get_procedure(procedure_id, procedure_acc_token)
with freeze_time("2021-09-20"):
procedure_id, procedure_acc_token = await create_procedure(procedure)
bid_id_1, bid_token_1 = await create_bid(procedure_id, bid)
await set_bid_status(procedure_id, bid_id_1, bid_token_1, 'active')
bid_id_2, bid_token_2 = await create_bid(procedure_id, bid)
await set_bid_status(procedure_id, bid_id_2, bid_token_2, 'active')
await set_procedure_status(procedure_id, 'active_awarded')
proc = await get_procedure(procedure_id, procedure_acc_token)
prolongation = get_raw_prolongation()
prolongation['awardId'] = proc['awards'][0]['id']
prolongation_date = (datetime.now() + timedelta(minutes=1)).isoformat()
prolongation = get_raw_prolongation(prolongation_date)
prolongation['awardId'] = proc['awards'][0]['id']
resp = await send_request(procedure_id, 'prolongations', b=prolongation, m="POST", t=procedure_acc_token)
assert resp.status == 201
data = await resp.json()
_id = data['id']
resp = await send_request(procedure_id, 'prolongations', b=prolongation, m="POST", t=procedure_acc_token)
assert resp.status == 201
data = await resp.json()
_id = data['id']
upd_object = {
"reason": "paymentImpossibility",
"prolongationTerm": (datetime.now() + timedelta(days=10)).isoformat(),
"decisionId": "string",
"description": "string",
"prolongationDate": (datetime.now() + timedelta(days=10)).isoformat(),
"documents": [],
"awardId": "string",
}
resp = await send_request(procedure_id, 'prolongations', _id, b=upd_object, m="PATCH", t=procedure_acc_token)
upd_object = {
"reason": "paymentImpossibility",
"prolongationTerm": (datetime.now() + timedelta(days=10)).isoformat(),
"decisionId": "string",
"description": "string",
"prolongationDate": (datetime.now() + timedelta(days=10)).isoformat(),
"documents": [],
"awardId": "string",
}
resp = await send_request(procedure_id, 'prolongations', _id, b=upd_object, m="PATCH",
t=procedure_acc_token)
assert resp.status == 422
data = await resp.json()
assert data['message'] == {'decisionId': 'Can not be set with this endpoint.',
'description': 'Can not be set with this endpoint.',
'prolongationDate': 'Can not be set with this endpoint.',
'documents': 'Can not be set with this endpoint.',
'awardId': 'Can not be set with this endpoint.'}
assert resp.status == 422
data = await resp.json()
assert data['message'] == {'decisionId': 'Can not be set with this endpoint.',
'description': 'Can not be set with this endpoint.',
'prolongationDate': 'Can not be set with this endpoint.',
'documents': 'Can not be set with this endpoint.',
'awardId': 'Can not be set with this endpoint.'}
async def test_activate_prolongation(
self, procedure, create_procedure, get_procedure, get_raw_prolongation, send_request, bid,
......@@ -1187,44 +1190,48 @@ class TestDgfActiveAwarded:
self, procedure, create_procedure, get_procedure, get_raw_prolongation, bid,
send_request, get_doc_with_doc_type, create_bid, set_bid_status, set_procedure_status
):
procedure_id, procedure_acc_token = await create_procedure(procedure)
bid_id_1, bid_token_1 = await create_bid(procedure_id, bid)
await set_bid_status(procedure_id, bid_id_1, bid_token_1, 'active')
bid_id_2, bid_token_2 = await create_bid(procedure_id, bid)
await set_bid_status(procedure_id, bid_id_2, bid_token_2, 'active')
await set_procedure_status(procedure_id, 'active_awarded')
proc = await get_procedure(procedure_id, procedure_acc_token)
assert len(proc['awards']) == 2
assert len(proc['contracts']) == 1
with freeze_time("2021-09-20"):
procedure_id, procedure_acc_token = await create_procedure(procedure)
bid_id_1, bid_token_1 = await create_bid(procedure_id, bid)
await set_bid_status(procedure_id, bid_id_1, bid_token_1, 'active')
bid_id_2, bid_token_2 = await create_bid(procedure_id, bid)
await set_bid_status(procedure_id, bid_id_2, bid_token_2, 'active')
await set_procedure_status(procedure_id, 'active_awarded')
proc = await get_procedure(procedure_id, procedure_acc_token)
assert len(proc['awards']) == 2
assert len(proc['contracts']) == 1
award_id = proc['awards'][0]['id']
award_id = proc['awards'][0]['id']
prolongation = get_raw_prolongation()
prolongation['awardId'] = award_id
prolongation_date = (datetime.now() + timedelta(minutes=1)).isoformat()
prolongation = get_raw_prolongation(prolongation_date)
prolongation['awardId'] = award_id
resp = await send_request(procedure_id, 'prolongations', b=prolongation, m="POST", t=procedure_acc_token)
assert resp.status == 201
data = await resp.json()
_id = data['id']
resp = await send_request(procedure_id, 'prolongations', b=prolongation, m="POST", t=procedure_acc_token)
assert resp.status == 201
data = await resp.json()
_id = data['id']
doc = get_doc_with_doc_type('rejectionProtocol')
resp = await send_request(procedure_id, 'awards', award_id, 'documents', b=doc, m="POST", t=procedure_acc_token)
assert resp.status == 201
resp = await send_request(procedure_id, 'awards', award_id, b={'terminationReason': '1'}, m="patch",
t=procedure_acc_token)
assert resp.status == 200
resp = await send_request(procedure_id, 'awards', award_id, 'status', b={'status': 'unsuccessful'}, m="PATCH",
t=procedure_acc_token)
assert resp.status == 200
doc = get_doc_with_doc_type('rejectionProtocol')
resp = await send_request(procedure_id, 'awards', award_id, 'documents', b=doc, m="POST",
t=procedure_acc_token)
assert resp.status == 201
resp = await send_request(procedure_id, 'awards', award_id, b={'terminationReason': '1'}, m="patch",
t=procedure_acc_token)
assert resp.status == 200
resp = await send_request(procedure_id, 'awards', award_id, 'status', b={'status': 'unsuccessful'},
m="PATCH", t=procedure_acc_token)
assert resp.status == 200
upd_object = {
"reason": "paymentImpossibility",
"prolongationTerm": (datetime.now() + timedelta(days=10)).isoformat()
}
resp = await send_request(procedure_id, 'prolongations', _id, b=upd_object, m="PATCH", t=procedure_acc_token)
assert resp.status == 403
data = await resp.json()
assert data['message'] in 'Forbidden status. Cannot prolong award object with status unsuccessful'
upd_object = {
"reason": "paymentImpossibility",
"prolongationTerm": (datetime.now() + timedelta(days=10)).isoformat()
}
resp = await send_request(procedure_id, 'prolongations', _id, b=upd_object, m="PATCH",
t=procedure_acc_token)
assert resp.status == 403
data = await resp.json()
assert data['message'] in 'Forbidden status. Cannot prolong award object with status unsuccessful'
async def test_complete_procedure_pending_waiting_award(
self, procedure, create_procedure, send_request, bid,
......
......@@ -36,11 +36,12 @@ class FixtureMixin:
item['itemProps'] = props
return item
def get_raw_polongation(self, date=None):
def get_raw_prolongation(self, date=None):
prolongation = self.get_fixture_by_name(self.prolongation_fixture_name)
if date:
prolongation['datePublished'] = date
prolongation['datePublished'] = datetime.now().isoformat()
prolongation['prolongationDate'] = date
else:
prolongation['prolongationDate'] = datetime.now().isoformat()
return prolongation
def get_raw_doc_with_doc_type(self, doc_type, doc_of='auction'):
......
......@@ -92,7 +92,7 @@ class FixtureMixin:
item['itemProps'] = props
return item
def get_raw_polongation(self, date=None):
def get_raw_prolongation(self, date=None):
prolongation = self.get_fixture_by_name(self.prolongation_fixture_name)
if date:
prolongation['prolongationDate'] = date
......@@ -1032,7 +1032,7 @@ class TestDgfActiveAwarded(FixtureMixin, BaseAPITest):
self.assertEqual(len(proc['awards']), 2)
self.assertEqual(len(proc['contracts']), 1)
prolongation = self.get_raw_polongation()
prolongation = self.get_raw_prolongation()
prolongation['awardId'] = proc['awards'][0]['id']
resp = await self.send_request(proc_id, 'prolongations', b=prolongation, m="POST", t=acc_token)
......@@ -1059,7 +1059,7 @@ class TestDgfActiveAwarded(FixtureMixin, BaseAPITest):
t=acc_token)
self.assertEqual(resp.status, 200)
prolongation = self.get_raw_polongation()
prolongation = self.get_raw_prolongation()
prolongation['awardId'] = award_id
resp = await self.send_request(proc_id, 'prolongations', b=prolongation, m="POST", t=acc_token)
......@@ -1074,7 +1074,7 @@ class TestDgfActiveAwarded(FixtureMixin, BaseAPITest):
self.assertEqual(len(proc['awards']), 2)
self.assertEqual(len(proc['contracts']), 1)
prolongation = self.get_raw_polongation()
prolongation = self.get_raw_prolongation()
prolongation['awardId'] = 'test'
resp = await self.send_request(proc_id, 'prolongations', b=prolongation, m="POST", t=acc_token)
......@@ -1092,7 +1092,7 @@ class TestDgfActiveAwarded(FixtureMixin, BaseAPITest):
self.assertEqual(len(proc['awards']), 2)
self.assertEqual(len(proc['contracts']), 1)
prolongation = self.get_raw_polongation()
prolongation = self.get_raw_prolongation()
prolongation['awardId'] = proc['awards'][0]['id']
prolongation.pop('reason', None)
......@@ -1110,35 +1110,37 @@ class TestDgfActiveAwarded(FixtureMixin, BaseAPITest):
@test_utils.unittest_run_loop
async def test_activate_prolongation_with_rogue_fields(self, _mock):
proc_id, acc_token = await self.create_procedure()
proc = await self.get_procedure(proc_id, acc_token)
with freeze_time("2020-10-10"):
proc_id, acc_token = await self.create_procedure()
proc = await self.get_procedure(proc_id, acc_token)
prolongation = self.get_raw_polongation()
prolongation['awardId'] = proc['awards'][0]['id']
prolongation_date = (datetime.now() + timedelta(minutes=1)).isoformat()
prolongation = self.get_raw_prolongation(prolongation_date)
prolongation['awardId'] = proc['awards'][0]['id']
resp = await self.send_request(proc_id, 'prolongations', b=prolongation, m="POST", t=acc_token)
self.assertEqual(resp.status, 201)
data = await resp.json()
_id = data['id']
resp = await self.send_request(proc_id, 'prolongations', b=prolongation, m="POST", t=acc_token)
self.assertEqual(resp.status, 201)
data = await resp.json()
_id = data['id']
upd_object = {
"reason": "paymentImpossibility",
"prolongationTerm": (datetime.now() + timedelta(days=10)).isoformat(),
"decisionId": "string",
"description": "string",
"prolongationDate": (datetime.now() + timedelta(days=10)).isoformat(),
"documents": [],
"awardId": "string",
}
resp = await self.send_request(proc_id, 'prolongations', _id, b=upd_object, m="PATCH", t=acc_token)
upd_object = {
"reason": "paymentImpossibility",
"prolongationTerm": (datetime.now() + timedelta(days=10)).isoformat(),
"decisionId": "string",
"description": "string",
"prolongationDate": (datetime.now() + timedelta(days=10)).isoformat(),
"documents": [],
"awardId": "string",
}
resp = await self.send_request(proc_id, 'prolongations', _id, b=upd_object, m="PATCH", t=acc_token)
self.assertEqual(resp.status, 422)
data = await resp.json()
self.assertEqual(data['message'], {'decisionId': 'Can not be set with this endpoint.',
'description': 'Can not be set with this endpoint.',
'prolongationDate': 'Can not be set with this endpoint.',
'documents': 'Can not be set with this endpoint.',
'awardId': 'Can not be set with this endpoint.'})
self.assertEqual(resp.status, 422)
data = await resp.json()
self.assertEqual(data['message'], {'decisionId': 'Can not be set with this endpoint.',
'description': 'Can not be set with this endpoint.',
'prolongationDate': 'Can not be set with this endpoint.',
'documents': 'Can not be set with this endpoint.',
'awardId': 'Can not be set with this endpoint.'})
@test_utils.unittest_run_loop
async def test_activate_prolongation(self, _mock):
......@@ -1146,7 +1148,7 @@ class TestDgfActiveAwarded(FixtureMixin, BaseAPITest):
proc_id, acc_token = await self.create_procedure()
proc = await self.get_procedure(proc_id, acc_token)
prolongation = self.get_raw_polongation()
prolongation = self.get_raw_prolongation()
prolongation['awardId'] = proc['awards'][0]['id']
prolongation['prolongationDate'] = str((datetime.now() + timedelta(minutes=1)).isoformat())
old_date = proc['awards'][0]['signingPeriod']['endDate']
......@@ -1191,39 +1193,41 @@ class TestDgfActiveAwarded(FixtureMixin, BaseAPITest):
@test_utils.unittest_run_loop
async def test_activate_prolongation_for_inactive_award(self, _mock):
proc_id, acc_token = await self.create_procedure()
proc = await self.get_procedure(proc_id, acc_token)
self.assertEqual(len(proc['awards']), 2)
self.assertEqual(len(proc['contracts']), 1)
with freeze_time("2020-10-10"):
proc_id, acc_token = await self.create_procedure()
proc = await self.get_procedure(proc_id, acc_token)
self.assertEqual(len(proc['awards']), 2)
self.assertEqual(len(proc['contracts']), 1)
award_id = proc['awards'][0]['id']
award_id = proc['awards'][0]['id']
prolongation = self.get_raw_polongation()
prolongation['awardId'] = award_id
prolongation_date = (datetime.now() + timedelta(minutes=1)).isoformat()
prolongation = self.get_raw_prolongation(prolongation_date)
prolongation['awardId'] = award_id
resp = await self.send_request(proc_id, 'prolongations', b=prolongation, m="POST", t=acc_token)
self.assertEqual(resp.status, 201)
data = await resp.json()
_id = data['id']
resp = await self.send_request(proc_id, 'prolongations', b=prolongation, m="POST", t=acc_token)
self.assertEqual(resp.status, 201)
data = await resp.json()
_id = data['id']
doc = self.get_raw_doc_with_doc_type('rejectionProtocol')
resp = await self.send_request(proc_id, 'awards', award_id, 'documents', b=doc, m="POST", t=acc_token)
self.assertEqual(resp.status, 201)
resp = await self.send_request(proc_id, 'awards', award_id, b={'terminationReason': '1'}, m="patch",
t=acc_token)
self.assertEqual(resp.status, 200)
resp = await self.send_request(proc_id, 'awards', award_id, 'status', b={'status': 'unsuccessful'}, m="PATCH",
t=acc_token)
self.assertEqual(resp.status, 200)
doc = self.get_raw_doc_with_doc_type('rejectionProtocol')
resp = await self.send_request(proc_id, 'awards', award_id, 'documents', b=doc, m="POST", t=acc_token)
self.assertEqual(resp.status, 201)
resp = await self.send_request(proc_id, 'awards', award_id, b={'terminationReason': '1'}, m="patch",
t=acc_token)
self.assertEqual(resp.status, 200)
resp = await self.send_request(proc_id, 'awards', award_id, 'status', b={'status': 'unsuccessful'},
m="PATCH", t=acc_token)
self.assertEqual(resp.status, 200)
upd_object = {
"reason": "paymentImpossibility",
"prolongationTerm": (datetime.now() + timedelta(days=10)).isoformat()
}
resp = await self.send_request(proc_id, 'prolongations', _id, b=upd_object, m="PATCH", t=acc_token)
self.assertEqual(resp.status, 403)
data = await resp.json()
self.assertIn(data['message'], 'Forbidden status. Cannot prolong award object with status unsuccessful')
upd_object = {
"reason": "paymentImpossibility",
"prolongationTerm": (datetime.now() + timedelta(days=10)).isoformat()
}
resp = await self.send_request(proc_id, 'prolongations', _id, b=upd_object, m="PATCH", t=acc_token)
self.assertEqual(resp.status, 403)
data = await resp.json()
self.assertIn(data['message'], 'Forbidden status. Cannot prolong award object with status unsuccessful')
@test_utils.unittest_run_loop
async def test_complete_procedure_pending_waiting_award(self, _mock):
......@@ -1311,7 +1315,7 @@ class TestDgfActiveAwarded(FixtureMixin, BaseAPITest):
{}).get('t')
self.assertEqual(qualification_end, old_callback_time)
prolongation = self.get_raw_polongation(datetime(2021, 1, 21, 0, 0, 2).isoformat())
prolongation = self.get_raw_prolongation(datetime(2021, 1, 21, 0, 0, 2).isoformat())
prolongation['awardId'] = award_1_id
resp = await self.send_request(proc_id, 'prolongations', b=prolongation, m="POST", t=acc_token)
......
......@@ -160,52 +160,81 @@ class TestDgfActiveAwarded(ActiveAwardedDocumentsTest):
assert winner.signingPeriod.endDate.strftime("%y-%m-%d %H:%M") == expected_prolongation
assert proc.qualificationPeriod.endDate.strftime("%y-%m-%d %H:%M") == expected_prolongation
@pytest.mark.parametrize('prolong_term', [
"2021-05-03T12:35:39.712000Z",
"2021-05-04T12:35:39.712000Z",
"2021-06-21T12:35:39.712000Z",
])
def test_prolong_period_in_weekend(self, make_active_awarded_procedure, make_bid, acl_context,
prolongation_data, prolong_term):
with freeze_time("2020-10-10"):
proc = make_active_awarded_procedure(
bids=[make_bid(status='active', amount=3000.0), make_bid(status='active', amount=3500.0)],
value_amount=1000.0
)
assert len(proc.awards) == 2
winner = proc.awards[0]
prolongation_data['awardId'] = winner.id
prolongation_data['prolongationDate'] = str((datetime.now() + timedelta(minutes=1)).isoformat())
prolongation = proc.Prolongation(prolongation_data)
prolog_id = proc.create_prolongation(prolongation, acl_context(proc))['id']
data = {
"reason": "paymentImpossibility",
"prolongationTerm": prolong_term
}
msg = r'^{"prolongationTerm": "Prolongation must be only on business day"\}$'
with pytest.raises(DataError, match=msg):
proc.activate_prolongation(prolog_id, data, acl_context(proc))
def test_prolong_periods_spoiled_date(self, make_active_awarded_procedure, make_bid, acl_context,
prolongation_data):
proc = make_active_awarded_procedure(
bids=[make_bid(status='active', amount=3000.0), make_bid(status='active', amount=3500.0)],
value_amount=1000.0
)
with freeze_time("2021-09-21"):
proc = make_active_awarded_procedure(
bids=[make_bid(status='active', amount=3000.0), make_bid(status='active', amount=3500.0)],
value_amount=1000.0
)
assert len(proc.awards) == 2
winner = proc.awards[0]
prolongation_data['awardId'] = winner.id
prolongation_data['prolongationDate'] = str((datetime.now() + timedelta(days=40)).isoformat())
prolongation = proc.Prolongation(prolongation_data)
with pytest.raises(DataError) as ex:
proc.create_prolongation(prolongation, acl_context(proc))
msg = 'Cannot be > procedure.qualificationPeriod.endDate'
assert ex.value.messages['prolongationDate'] == msg
assert len(proc.awards) == 2
winner = proc.awards[0]
prolongation_data['awardId'] = winner.id
prolongation_data['prolongationDate'] = str((datetime.now() + timedelta(days=40)).isoformat())
prolongation = proc.Prolongation(prolongation_data)
with pytest.raises(DataError) as ex:
proc.create_prolongation(prolongation, acl_context(proc))
msg = 'Cannot be > procedure.qualificationPeriod.endDate'
assert ex.value.messages['prolongationDate'] == msg
def test_prolong_periods_term(self, make_active_awarded_procedure, make_bid, acl_context, prolongation_data):
proc = make_active_awarded_procedure(
bids=[make_bid(status='active', amount=3000.0), make_bid(status='active', amount=3500.0)],
value_amount=1000.0
)
with freeze_time("2021-09-20"):
proc = make_active_awarded_procedure(
bids=[make_bid(status='active', amount=3000.0), make_bid(status='active', amount=3500.0)],
value_amount=1000.0
)
assert len(proc.awards) == 2
winner = proc.awards[0]
prolongation_data['awardId'] = winner.id
prolongation_data['prolongationDate'] = str(datetime.now().isoformat())
prolongation = proc.Prolongation(prolongation_data)
prolog_id = proc.create_prolongation(prolongation, acl_context(proc))['id']
data = {
"reason": "paymentImpossibility",
"prolongationTerm": str((datetime.now() + timedelta(days=200)).isoformat())
}
with pytest.raises(DataError) as ex:
proc.activate_prolongation(prolog_id, data, acl_context(proc))
msg = 'Cannot be > procedure.qualificationPeriod.startDate for 132 business days'
assert ex.value.messages['prolongationTerm'] == msg
assert len(proc.awards) == 2
winner = proc.awards[0]
prolongation_data['awardId'] = winner.id
prolongation_data['prolongationDate'] = str((datetime.now() + timedelta(minutes=1)).isoformat())
prolongation = proc.Prolongation(prolongation_data)
prolog_id = proc.create_prolongation(prolongation, acl_context(proc))['id']
data = {
"reason": "paymentImpossibility",
"prolongationTerm": str((datetime.now() + timedelta(days=200)).isoformat())
}
with pytest.raises(DataError) as ex:
proc.activate_prolongation(prolog_id, data, acl_context(proc))
msg = 'Cannot be > procedure.qualificationPeriod.startDate for 132 business days'
assert ex.value.messages['prolongationTerm'] == msg
data = {
"reason": "paymentImpossibility",
"prolongationTerm": str((datetime.now() - timedelta(days=200)).isoformat())
}
with pytest.raises(DataError) as ex:
proc.activate_prolongation(prolog_id, data, acl_context(proc))
msg = 'Cannot be <= procedure.qualificationPeriod.startDate'
assert ex.value.messages['prolongationTerm'] == msg
data = {
"reason": "paymentImpossibility",
"prolongationTerm": str((datetime.now() - timedelta(days=200)).isoformat())
}
with pytest.raises(DataError) as ex:
proc.activate_prolongation(prolog_id, data, acl_context(proc))
msg = 'Cannot be <= procedure.qualificationPeriod.startDate'
assert ex.value.messages['prolongationTerm'] == msg
def test_prolong_date_published(self, make_active_awarded_procedure, make_bid, acl_context, prolongation_data):
proc = make_active_awarded_procedure(
......@@ -237,24 +266,25 @@ class TestDgfActiveAwarded(ActiveAwardedDocumentsTest):
def test_prolong_term_less_than_date_publish(self, make_active_awarded_procedure, make_bid, acl_context,
prolongation_data):
proc = make_active_awarded_procedure(
bids=[make_bid(status='active', amount=3000.0), make_bid(status='active', amount=3500.0)],
value_amount=1000.0
)
with freeze_time("2021-09-20"):
proc = make_active_awarded_procedure(
bids=[make_bid(status='active', amount=3000.0), make_bid(status='active', amount=3500.0)],