-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated code to set header on email subject based on desired logic #39
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
src/regtech_mail_api/api.py
Outdated
subject = f"[DEV BETA] SBL User Request for {type}" | ||
|
||
header = "[BETA]" | ||
if "cfpb" in sender_addr: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if "cfpb" in sender_addr: | |
sender_addr.lower().endswith('cfpb.gov'): |
...just to be extra safe and make sure we don't capture some [email protected]
type address?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, will update. There are some test CFPB domains we use to verify they’re not associated yet so we’ll just need to make sure they follow a *cfpb.gov format and not @cfpb-test.gov type thing. Or building a configurable list of domains that will get flagged [CFPB BETA]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok changed the check to split on the @ and check for "cfpb" in the domain place. That will allow Bill's current test email accounts to stay the same format but would flag them appropriately.
Closes #38
Tested locally in docker by setting ENVIRONMENT: DEV in the docker-compose env variables for the mailing-api, which sent to mailpint an email with
"subject": "[DEV BETA] SBL User Request for Institution Profile Change"
Then removed the ENVIRONMENT variable and changed the keycloak user to have both @cfpg.gov and @new-cfpb.gov email domains, both results ended in an email with
"subject": "[CFPB BETA] SBL User Request for Institution Profile Change"
Changed account to have an email domain of "citibank.com" and had an email sent with
"subject": "[BETA] SBL User Request for Institution Profile Change"