Skip to content

[ENG-8172] Improve email testing #11170

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

Conversation

Ostap-Zherebetskyi
Copy link
Contributor

Purpose

TBD

Changes

TBD

QA Notes

TBD

Documentation

TBD

Side Effects

TBD

Ticket

https://openscience.atlassian.net/browse/ENG-8172

@Ostap-Zherebetskyi Ostap-Zherebetskyi marked this pull request as ready for review June 5, 2025 15:25
@Ostap-Zherebetskyi Ostap-Zherebetskyi force-pushed the feature/update_mail_testing branch 2 times, most recently from 338ab3b to 1c7e2d2 Compare June 6, 2025 10:47
Copy link
Contributor

@Johnetordoff Johnetordoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good work, but you should include tests for the user confirmation email token being received. We've had issues in the past with browsers automatically requesting email links, like the token confirmation link and we need unittests to ensure the confirmation token is received and usable. But otherwise good.

Copy link
Contributor

@Johnetordoff Johnetordoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, other then a minor issue with the Waffle Flagging, but I got several errors testting the test_mailhog.py tests locally via the command line. I tweaked the host a little and this seems to work for CI and locall:y Johnetordoff@eb00648 If you can reproduce the issue locally and fix this way (or some other way), I will approve the PR.

@@ -119,6 +148,17 @@ def send_mail(
logger.debug('Sending email...')
logger.debug(f'To: {to_addr}\nFrom: {from_addr}\nSubject: {subject}\nMessage: {message}')

if waffle.switch_is_active(features.ENABLE_MAILHOG):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a flag instead of a switch, Waffle Flags can use the request/user object to determine the flag's value, that will allow us to set a group of beta testers or staff who can test using the admin app on staging environments Waffle Switches are all or nothing, so Flags are a big improvement here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use flags here because not all emails are triggered with a request, which is a required parameter in flag_is_active

@Johnetordoff Johnetordoff merged commit 2f102f7 into CenterForOpenScience:refactor-notifications Jul 2, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants