Skip to content

Commit

Permalink
Checked email vals in test. Added log and updated data types.
Browse files Browse the repository at this point in the history
  • Loading branch information
guffee23 committed Nov 26, 2024
1 parent a5d220b commit f5df890
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sbl_filing_api/services/request_handler.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import logging

import httpx
from pydantic import EmailStr
from sbl_filing_api.config import settings

logger = logging.getLogger(__name__)


def send_confirmation_email(
user_full_name: str, user_email: str, contact_info_email: str, confirmation_id: str, timestamp: int
user_full_name: EmailStr, user_email: EmailStr, contact_info_email: EmailStr, confirmation_id: EmailStr, timestamp: int
):
confirmation_request = {
"confirmation_id": confirmation_id,
Expand All @@ -20,5 +21,7 @@ def send_confirmation_email(
res = httpx.post(settings.mail_api_url, json=confirmation_request)
if res.status_code != 200:
logger.error(res.text)
else:
logger.info(res.text)
except Exception:
logger.exception(f"Failed to send confirmation email for {user_full_name}")
1 change: 1 addition & 0 deletions tests/api/routers/test_filing_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ async def test_good_sign_filing(
action_type=UserActionType.SIGN,
),
)
send_email_mock.assert_called_with("Test User", "[email protected]", '[email protected]', ANY, ANY)
assert upsert_mock.call_args.args[1].confirmation_id.startswith("1234567890ABCDEFGH00-2024-5-")
assert res.status_code == 200
assert float(upsert_mock.call_args.args[1].confirmation_id.split("-")[3]) == pytest.approx(
Expand Down

0 comments on commit f5df890

Please sign in to comment.