Skip to content

Commit

Permalink
20179 admin dissolution - delete amalgamations and amalgamating_busin…
Browse files Browse the repository at this point in the history
…esses data (#2515) cherry pick fixes
  • Loading branch information
JazzarKarim committed Mar 20, 2024
1 parent af74bda commit 9ce7419
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from entity_filer.filing_meta import FilingMeta
from entity_filer.filing_processors import dissolution
from entity_filer.worker import process_filing

from tests.unit import create_business, create_filing

# from tests.utils import upload_file, assert_pdf_contains_text, has_expected_date_str_format


Expand Down Expand Up @@ -237,44 +237,47 @@ def test_administrative_dissolution(app, session, legal_type, identifier, dissol
assert filing_json["filing"]["dissolution"]["details"] == final_filing.order_details


@pytest.mark.parametrize('dissolution_type', [
('administrative'),
('voluntary'),
])
@pytest.mark.parametrize(
"dissolution_type",
[
("administrative"),
("voluntary"),
],
)
async def test_amalgamation_administrative_dissolution(app, session, mocker, dissolution_type):
"""Assert that the dissolution is processed."""
from tests.unit.test_worker.test_amalgamation_application import test_regular_amalgamation_application_process

identifier = await test_regular_amalgamation_application_process(app, session)
# setup
dissolution_filing_json = copy.deepcopy(FILING_HEADER)
dissolution_filing_json['filing']['header']['name'] = 'dissolution'
dissolution_filing_json['filing']['dissolution'] = DISSOLUTION
dissolution_filing_json['filing']['dissolution']['dissolutionDate'] = '2018-04-08'
dissolution_filing_json['filing']['dissolution']['dissolutionType'] = dissolution_type
dissolution_filing_json['filing']['dissolution']['hasLiabilities'] = False
dissolution_filing_json['filing']['dissolution']['details'] = 'Some Details here'
dissolution_filing_json["filing"]["header"]["name"] = "dissolution"
dissolution_filing_json["filing"]["dissolution"] = DISSOLUTION
dissolution_filing_json["filing"]["dissolution"]["dissolutionDate"] = "2018-04-08"
dissolution_filing_json["filing"]["dissolution"]["dissolutionType"] = dissolution_type
dissolution_filing_json["filing"]["dissolution"]["hasLiabilities"] = False
dissolution_filing_json["filing"]["dissolution"]["details"] = "Some Details here"

business = LegalEntity.find_by_identifier(identifier)
filing = create_filing('123', dissolution_filing_json, business_id=business.id)
filing = create_filing("123", dissolution_filing_json, business_id=business.id)
filing.effective_date = datetime.now()
filing.save()

# test
filing_msg = {'filing': {'id': filing.id}}
filing_msg = {"filing": {"id": filing.id}}


# mock out the email sender and event publishing
mocker.patch('entity_filer.worker.publish_email_message', return_value=None)
mocker.patch('entity_filer.worker.publish_event', return_value=None)
mocker.patch('legal_api.services.bootstrap.AccountService.update_entity', return_value=None)
mocker.patch("entity_filer.worker.publish_email_message", return_value=None)
mocker.patch("entity_filer.worker.publish_event", return_value=None)
mocker.patch("legal_api.services.bootstrap.AccountService.update_entity", return_value=None)

await process_filing(filing_msg, app)

# validate
business = LegalEntity.find_by_identifier(identifier)
assert business.state == LegalEntity.State.HISTORICAL
assert business.state_filing_id == filing.id
if dissolution_type == 'administrative':
if dissolution_type == "administrative":
assert not business.amalgamation.one_or_none()
else:
amalgamation = business.amalgamation.one_or_none()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def test_regular_amalgamation_application_process(app, session):
assert amalgamating_business.foreign_name
assert amalgamating_business.foreign_identifier

return next_corp_num


@pytest.mark.parametrize(
"amalgamation_type, amalgamating_role",
Expand Down

0 comments on commit 9ce7419

Please sign in to comment.