Skip to content

Commit

Permalink
update COA processor to skip batch_processing entry that has trigger_…
Browse files Browse the repository at this point in the history
…date more than 60 days

Signed-off-by: Hongjing Chen <[email protected]>
  • Loading branch information
chenhongjing committed Jun 17, 2024
1 parent 51010c9 commit 4198c46
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def process(business: Business, filing: Dict, filing_meta: FilingMeta, flag_on:
if batch_processing.status not in [
BatchProcessing.BatchProcessingStatus.COMPLETED,
BatchProcessing.BatchProcessingStatus.WITHDRAWN
]:
] and datetime.utcnow() + datedelta(days=60) > batch_processing.trigger_date:
batch_processing.trigger_date = datetime.utcnow() + datedelta(days=62)
batch_processing.meta_data = {
**batch_processing.meta_data,
Expand All @@ -58,4 +58,4 @@ def process(business: Business, filing: Dict, filing_meta: FilingMeta, flag_on:
target_dissolution_date = date.fromisoformat(batch_processing.meta_data['targetDissolutionDate'])
target_dissolution_date += datedelta(days=62)
batch_processing.meta_data['targetDissolutionDate'] = target_dissolution_date.isoformat()
batch_processing.last_modified=datetime.utcnow()
batch_processing.last_modified = datetime.utcnow()
Original file line number Diff line number Diff line change
Expand Up @@ -59,33 +59,51 @@ def test_change_of_address_process(app, session):
assert delivery_address.city == 'new delivery_address city'


@pytest.mark.parametrize('test_name, status, step, delay', [
@pytest.mark.parametrize('test_name, status, step, trigger_date, delay', [
(
'DELAY_IN_DISSOLUTION_STAGE_1',
BatchProcessing.BatchProcessingStatus.PROCESSING,
BatchProcessing.BatchProcessingStep.WARNING_LEVEL_1,
datetime.utcnow()+datedelta(days=42),
True
),
(
'DELAY_IN_DISSOLUTION_STAGE_2',
BatchProcessing.BatchProcessingStatus.PROCESSING,
BatchProcessing.BatchProcessingStep.WARNING_LEVEL_2,
datetime.utcnow()+datedelta(days=42),
True
),
(
'NO_DELAY_NOT_IN_DISSOLUTION_1',
BatchProcessing.BatchProcessingStatus.COMPLETED,
BatchProcessing.BatchProcessingStep.DISSOLUTION,
datetime.utcnow()+datedelta(days=42),
False
),
(
'NO_DELAY_NOT_IN_DISSOLUTION_2',
BatchProcessing.BatchProcessingStatus.WITHDRAWN,
BatchProcessing.BatchProcessingStep.WARNING_LEVEL_1,
datetime.utcnow()+datedelta(days=42),
False
),
(
'NO_DELAY_TRIGGER_DATE_MORE_THAN_60_DAYS_STAGE_1',
BatchProcessing.BatchProcessingStatus.PROCESSING,
BatchProcessing.BatchProcessingStep.WARNING_LEVEL_1,
datetime.utcnow()+datedelta(days=70),
False
),
(
'NO_DELAY_TRIGGER_DATE_MORE_THAN_60_DAYS_STAGE_2',
BatchProcessing.BatchProcessingStatus.PROCESSING,
BatchProcessing.BatchProcessingStep.WARNING_LEVEL_1,
datetime.utcnow()+datedelta(days=70),
False
)
])
def test_change_of_address_delay_dissolution(app, session, test_name, status, step, delay):
def test_change_of_address_delay_dissolution(app, session, test_name, status, step, trigger_date, delay):
"""Assert that involuntary dissolution is delayed."""
identifier = 'CP1234567'
business = create_business(identifier)
Expand All @@ -94,7 +112,8 @@ def test_change_of_address_delay_dissolution(app, session, test_name, status, st
business_id=business.id,
identifier=business.identifier,
status=status,
step=step)
step=step,
trigger_date=trigger_date)

utc_now = datetime.utcnow()
dissolution_date = utc_now + datedelta(days=72)
Expand Down

0 comments on commit 4198c46

Please sign in to comment.