generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
2 changed files
with
74 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
from regtech_api_commons.models.auth import AuthenticatedUser | ||
from starlette.authentication import AuthCredentials | ||
|
||
from datetime import datetime | ||
|
||
|
||
@pytest.fixture | ||
def app_fixture(mocker: MockerFixture) -> FastAPI: | ||
|
@@ -113,6 +115,60 @@ def test_case_send( | |
assert res.status_code == 200 | ||
assert res.json() == email_json | ||
|
||
def test_email_dates( | ||
self, mocker: MockerFixture, app_fixture: FastAPI, full_user_mock: Mock | ||
): | ||
client = TestClient(app_fixture) | ||
res = client.post( | ||
"/internal/confirmation/send", | ||
data=json.dumps( | ||
{ | ||
"confirmation_id": "test", | ||
"signer_email": "[email protected]", | ||
"signer_name": "Test User", | ||
"contact_email": "[email protected]", | ||
"timestamp": datetime(2024, 3, 15, 8, 10).timestamp() * 1000, | ||
} | ||
), | ||
) | ||
|
||
expected_email = { | ||
"subject": "[BETA] Small Business Lending Data Filing Confirmation", | ||
"body": "\nCongratulations! This email confirms that the filing submitted by Test User on March 15, 2024 at 10:10 a.m. EST was successful. The confirmation number is test.\n\nThe beta platform is for testing purposes only and user-supplied data may be removed at any time. Take a moment to email our support staff at [email protected] with your feedback or return to the beta platform and upload a new file to continue testing.\n", | ||
"from_addr": "[email protected]", | ||
"to": ["[email protected]"], | ||
"cc": None, | ||
"bcc": None, | ||
} | ||
|
||
assert res.status_code == 200 | ||
assert res.json()["email"] == expected_email | ||
|
||
res = client.post( | ||
"/internal/confirmation/send", | ||
data=json.dumps( | ||
{ | ||
"confirmation_id": "test", | ||
"signer_email": "[email protected]", | ||
"signer_name": "Test User", | ||
"contact_email": "[email protected]", | ||
"timestamp": datetime(2024, 9, 15, 13, 10).timestamp() * 1000, | ||
} | ||
), | ||
) | ||
|
||
expected_email = { | ||
"subject": "[BETA] Small Business Lending Data Filing Confirmation", | ||
"body": "\nCongratulations! This email confirms that the filing submitted by Test User on Sept. 15, 2024 at 3:10 p.m. EST was successful. The confirmation number is test.\n\nThe beta platform is for testing purposes only and user-supplied data may be removed at any time. Take a moment to email our support staff at [email protected] with your feedback or return to the beta platform and upload a new file to continue testing.\n", | ||
"from_addr": "[email protected]", | ||
"to": ["[email protected]"], | ||
"cc": None, | ||
"bcc": None, | ||
} | ||
|
||
assert res.status_code == 200 | ||
assert res.json()["email"] == expected_email | ||
|
||
def test_confirmation_send( | ||
self, mocker: MockerFixture, app_fixture: FastAPI, full_user_mock: Mock | ||
): | ||
|
@@ -132,7 +188,7 @@ def test_confirmation_send( | |
|
||
expected_email = { | ||
"subject": "[BETA] Small Business Lending Data Filing Confirmation", | ||
"body": "\nCongratulations! This email confirms that the filing submitted by Test User on November 20, 2024 at 1:51 PM EST was successful. The confirmation number is test.\n\nThe beta platform is for testing purposes only and user-supplied data may be removed at any time. Take a moment to email our support staff at [email protected] with your feedback or return to the beta platform and upload a new file to continue testing.\n", | ||
"body": "\nCongratulations! This email confirms that the filing submitted by Test User on Nov. 20, 2024 at 1:51 p.m. EST was successful. The confirmation number is test.\n\nThe beta platform is for testing purposes only and user-supplied data may be removed at any time. Take a moment to email our support staff at [email protected] with your feedback or return to the beta platform and upload a new file to continue testing.\n", | ||
"from_addr": "[email protected]", | ||
"to": ["[email protected]"], | ||
"cc": None, | ||
|
@@ -149,7 +205,7 @@ def test_confirmation_send( | |
mock_settings.from_addr = "[email protected]" | ||
expected_email = { | ||
"subject": "Small Business Lending Data Filing Confirmation", | ||
"body": "\nCongratulations! This email confirms that the filing submitted by Test User on November 20, 2024 at 1:51 PM EST was successful. The confirmation number is test.\n\nTo make any changes to the filing, please return to the Small Business Lending Data Filing Platform and follow the provided instructions. If you have any questions or need additional support, email our support staff at [email protected].\n", | ||
"body": "\nCongratulations! This email confirms that the filing submitted by Test User on Nov. 20, 2024 at 1:51 p.m. EST was successful. The confirmation number is test.\n\nTo make any changes to the filing, please return to the Small Business Lending Data Filing Platform and follow the provided instructions. If you have any questions or need additional support, email our support staff at [email protected].\n", | ||
"from_addr": "[email protected]", | ||
"to": ["[email protected]", "[email protected]"], | ||
"cc": None, | ||
|