-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat: Email with any SMTP server + Testing Email #13
Conversation
Coverage for unit tests for Python 3.11
|
Coverage for e2e tests for Python 3.11
|
Coverage for unit tests for Python 3.12
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
+ Coverage 47.49% 49.79% +2.29%
==========================================
Files 17 19 +2
Lines 878 964 +86
==========================================
+ Hits 417 480 +63
- Misses 461 484 +23 ☔ View full report in Codecov by Sentry. |
Coverage for e2e tests for Python 3.10
|
Coverage for e2e tests for Python 3.12
|
Coverage for unit tests for Python 3.11
|
Coverage for unit tests for Python 3.10
|
Coverage for unit tests for Python 3.12
|
Coverage for e2e tests for Python 3.10
|
Coverage for e2e tests for Python 3.11
|
Coverage for e2e tests for Python 3.12
|
Coverage for unit tests for Python 3.11
|
Coverage for unit tests for Python 3.10
|
Coverage for e2e tests for Python 3.11
|
Coverage for unit tests for Python 3.12
|
Coverage for e2e tests for Python 3.10
|
Coverage for e2e tests for Python 3.12
|
Coverage for unit tests for Python 3.10
|
Coverage for e2e tests for Python 3.11
|
Coverage for e2e tests for Python 3.10
|
Coverage for unit tests for Python 3.12
|
Coverage for e2e tests for Python 3.11
|
Coverage for e2e tests for Python 3.12
|
|
||
PHOTO_DIRECTORY = getenv('PHOTO_DIRECTORY', "placeholder") | ||
PHOTO_DIRECTORY = getenv('PHOTO_DIRECTORY', "unset") |
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.
I wonder if it makes sense to use None
for default values?
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 we don't specify a default value it is already None
.
The getenv helper I wrote will raise exception when the variable is None
.
class ConfigBase(object):
@staticmethod
def getenv(key, default: Optional[str] = None):
val = os.getenv(key, default)
if val is None:
raise EnvironmentalVariableMissingError(key)
return val
Providing a non-None
default value is a way to make this var optional.
But they are not really optional - if you want the email to be actually sent then you have to provide it.
But in DEV env then you don't want email to be sent. They don't need to be there.
Erhh sounds a bit messy. Maybe for the email env vars I should just put them into DevelopmentConfig
Coverage for unit tests for Python 3.10
|
Coverage for unit tests for Python 3.11
|
Coverage for e2e tests for Python 3.10
|
Coverage for unit tests for Python 3.12
|
Coverage for e2e tests for Python 3.11
|
Coverage for e2e tests for Python 3.12
|
Coverage for unit tests for Python 3.10
|
Coverage for unit tests for Python 3.11
|
Coverage for e2e tests for Python 3.10
|
Coverage for unit tests for Python 3.12
|
Coverage for e2e tests for Python 3.11
|
Coverage for e2e tests for Python 3.12
|
Coverage for unit tests for Python 3.11
|
Coverage for unit tests for Python 3.10
|
Coverage for e2e tests for Python 3.10
|
Coverage for e2e tests for Python 3.11
|
Coverage for unit tests for Python 3.12
|
Coverage for e2e tests for Python 3.12
|
This PR revamped the email sending feature. There are three highlights:
Generic SMTP email provider support
This PR removed sendgrid-related stuff from repo and now allows emails to be handled by any generic smtp server, specified by these four env vars:
Extensible Email Templating
This PR removed the hardcoded template using a python string and the awkward substitution symbols. It now supports a file-based template and metadata, and a enum to select from different template. This makes adding template in future much easier.
3 Ways to Test Email Feature
This PR added 3 ways to test email feature:
send_message
etc) are called. (Will be tested in CI)I have written 5 test cases to cover the emailing feature for both plain text and html content.
The documentation is updated accordingly.