Skip to content

Commit

Permalink
21330 Filer - Add involuntary dissolution unit tests (bcgov#2749)
Browse files Browse the repository at this point in the history
* Add unit tests

* Temporarily revert lear requirements change

* Reinstate lear requirements change

* Change testcontainers version to work with python 3.8

* Fix lint errors

* Undo testcontainers version bump
  • Loading branch information
leodube-aot authored Jun 13, 2024
1 parent 3c5ea91 commit 86ab020
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions queue_services/entity-filer/src/entity_filer/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ class _Config(): # pylint: disable=too-few-public-methods
NAMEX_PAY_TOPIC = os.getenv('NAMEX_PAY_TOPIC', 'namex-pay-dev')

AUDIENCE = os.getenv(
"AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Subscriber"
'AUDIENCE', 'https://pubsub.googleapis.com/google.pubsub.v1.Subscriber'
)
PUBLISHER_AUDIENCE = os.getenv(
"PUBLISHER_AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Publisher"
'PUBLISHER_AUDIENCE', 'https://pubsub.googleapis.com/google.pubsub.v1.Publisher'
)


Expand Down
14 changes: 6 additions & 8 deletions queue_services/entity-filer/src/entity_filer/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@
from entity_queue_common.service import QueueServiceManager
from entity_queue_common.service_utils import FilingException, QueueException, logger
from flask import Flask
from gcp_queue import GcpQueue
from gcp_queue import SimpleCloudEvent
from gcp_queue import to_queue_message
from gcp_queue import GcpQueue, SimpleCloudEvent, to_queue_message
from legal_api import db
from legal_api.core import Filing as FilingCore
from legal_api.models import Business, Filing
from legal_api.utils.datetime import datetime
from legal_api.utils.datetime import timezone
from legal_api.utils.datetime import datetime, timezone
from sentry_sdk import capture_message
from sqlalchemy.exc import OperationalError
from sqlalchemy_continuum import versioning_manager
Expand Down Expand Up @@ -101,6 +98,7 @@ def get_filing_types(legal_filings: dict):
filing_types.append(k)
return filing_types


async def publish_event(business: Business, filing: Filing):
"""Publish the filing message onto the NATS filing subject."""
try:
Expand Down Expand Up @@ -160,13 +158,13 @@ def publish_gcp_queue_event(business: Business, filing: Filing):
business.identifier,
'/filing/',
str(filing.id)]),
subject=subject,
subject=subject,
time=datetime.now(timezone.utc),
type='bc.registry.business.' + filing.filing_type,
data=data
)
gcp_queue.publish(subject,to_queue_message(ce))

gcp_queue.publish(subject, to_queue_message(ce))

except Exception as err: # pylint: disable=broad-except; we don't want to fail out the filing, so ignore all.
capture_message('Queue Publish Event Error: filing.id=' + str(filing.id) + str(err), level='error')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@


@pytest.mark.parametrize('legal_type,identifier,dissolution_type', [
('BC', 'BC1234567', 'involuntary'),
('BEN', 'BC1234567', 'involuntary'),
('CC', 'BC1234567', 'involuntary'),
('ULC', 'BC1234567', 'involuntary'),
('LLC', 'BC1234567', 'involuntary'),
('CP', 'CP1234567', 'involuntary'),
('SP', 'FM1234567', 'involuntary'),
('GP', 'FM1234567', 'involuntary'),
('BC', 'BC1234567', 'voluntary'),
('BEN', 'BC1234567', 'voluntary'),
('CC', 'BC1234567', 'voluntary'),
Expand Down Expand Up @@ -226,6 +234,7 @@ def test_administrative_dissolution(app, session, minio_server, legal_type, iden

@pytest.mark.parametrize('dissolution_type', [
('administrative'),
('involuntary'),
('voluntary'),
])
async def test_amalgamation_administrative_dissolution(app, session, mocker, dissolution_type):
Expand Down

0 comments on commit 86ab020

Please sign in to comment.