-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89d9d73
commit d3d5c89
Showing
6 changed files
with
92 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,15 @@ | |
from legal_api.models import Business | ||
|
||
from entity_emailer.email_processors import bn_notification | ||
from tests.unit import prep_incorp_filing, prep_registration_filing | ||
from tests.unit import ( | ||
prep_amalgamation_filing, | ||
prep_continuation_in_filing, | ||
prep_incorp_filing, | ||
prep_registration_filing, | ||
) | ||
|
||
|
||
def test_bn_notificaton(app, session): | ||
def test_incorporation_bn_notificaton(app, session): | ||
"""Assert that the bn email processor builds the email correctly.""" | ||
# setup filing + business for email | ||
identifier = 'BC1234567' | ||
|
@@ -40,6 +45,46 @@ def test_bn_notificaton(app, session): | |
assert email['content']['attachments'] == [] | ||
|
||
|
||
def test_amalgamation_bn_notificaton(app, session): | ||
"""Assert bn notification email for Amalgamation filing.""" | ||
# setup filing + business for email | ||
identifier = 'BC1234567' | ||
filing = prep_amalgamation_filing(session, identifier, '1', 'bn', 'TED business') | ||
business = Business.find_by_identifier(identifier) | ||
# sanity check | ||
assert filing.id | ||
assert business.id | ||
# run processor | ||
email = bn_notification.process( | ||
{'filingId': None, 'type': 'businessNumber', 'option': 'bn', 'identifier': 'BC1234567'}) | ||
# check email values | ||
assert '[email protected]' in email['recipients'] | ||
assert '[email protected]' in email['recipients'] | ||
assert email['content']['subject'] == f'{business.legal_name} - Business Number Information' | ||
assert email['content']['body'] | ||
assert email['content']['attachments'] == [] | ||
|
||
|
||
def test_continuation_bn_notificaton(mocker, app, session): | ||
"""Assert bn notification email for Continuation filing.""" | ||
# setup filing + business for email | ||
identifier = 'BC1234567' | ||
filing = prep_continuation_in_filing(session, identifier, '1', 'bn') | ||
business = Business.find_by_identifier(identifier) | ||
# sanity check | ||
assert filing.id | ||
assert business.id | ||
# run processor | ||
email = bn_notification.process( | ||
{'filingId': None, 'type': 'businessNumber', 'option': 'bn', 'identifier': 'BC1234567'}) | ||
# check email values | ||
assert '[email protected]' in email['recipients'] | ||
assert '[email protected]' in email['recipients'] | ||
assert email['content']['subject'] == f'{business.legal_name} - Business Number Information' | ||
assert email['content']['body'] | ||
assert email['content']['attachments'] == [] | ||
|
||
|
||
def test_bn_move_notificaton(app, session): | ||
"""Assert that the bn move email processor builds the email correctly.""" | ||
# setup filing + business for email | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,11 @@ | |
# limitations under the License. | ||
"""The Unit Tests for the mras email processor.""" | ||
from entity_emailer.email_processors import mras_notification | ||
from tests.unit import prep_incorp_filing | ||
from tests.unit import prep_amalgamation_filing, prep_continuation_in_filing, prep_incorp_filing | ||
|
||
|
||
def test_mras_notification(app, session): | ||
"""Assert that the legal name is changed.""" | ||
def test_incorporation_app_mras_notification(app, session): | ||
"""Assert mras notification email for Incorporation application filing.""" | ||
# setup filing + business for email | ||
filing = prep_incorp_filing(session, 'BC1234567', '1', 'mras') | ||
# run processor | ||
|
@@ -28,3 +28,32 @@ def test_mras_notification(app, session): | |
assert email['content']['subject'] == 'BC Business Registry Partner Information' | ||
assert email['content']['body'] | ||
assert email['content']['attachments'] == [] | ||
|
||
|
||
def test_amalgamation_mras_notification(app, session): | ||
"""Assert mras notification email for Amalgamation filing.""" | ||
# setup filing + business for email | ||
filing = prep_amalgamation_filing(session, 'BC1234567', '1', 'mras', 'TED business') | ||
# run processor | ||
email = mras_notification.process( | ||
{'filingId': filing.id, 'type': 'amalgamationApplication', 'option': 'mras'}) | ||
# check email values | ||
assert email['recipients'] == '[email protected]' | ||
assert email['content']['subject'] == 'BC Business Registry Partner Information' | ||
assert email['content']['body'] | ||
assert email['content']['attachments'] == [] | ||
|
||
|
||
def test_continuation_mras_notification(app, session): | ||
"""Assert mras notification email for Continuation In filing.""" | ||
# setup filing + business for email | ||
filing = prep_continuation_in_filing(session, 'BC1234567', '1', 'mras') | ||
|
||
# run processor | ||
email = mras_notification.process( | ||
{'filingId': filing.id, 'type': 'continuationIn', 'option': 'mras'}) | ||
# check email values | ||
assert email['recipients'] == '[email protected]' | ||
assert email['content']['subject'] == 'BC Business Registry Partner Information' | ||
assert email['content']['body'] | ||
assert email['content']['attachments'] == [] |