rusackas commented on code in PR #40647:
URL: https://github.com/apache/superset/pull/40647#discussion_r3384816877
##########
tests/unit_tests/config_test.py:
##########
@@ -312,3 +312,13 @@ def test_full_setting(
assert dttm_col.is_dttm
assert dttm_col.python_date_format == "epoch_s"
assert dttm_col.expression == "CAST(dttm as INTEGER)"
+
+
+def test_smtp_ssl_server_auth_defaults_to_true() -> None:
+ """
+ The shipped default for SMTP_SSL_SERVER_AUTH validates the SMTP server's
+ TLS certificate. Operators can still opt out by overriding it to False.
+ """
+ from superset import config
+
+ assert config.SMTP_SSL_SERVER_AUTH is True
Review Comment:
Good call — addressed in the latest push. I added behavior-level unit tests
in `tests/unit_tests/config_test.py` alongside the default-assertion test
(which I kept):
- `test_send_mime_email_ssl_server_auth_passes_context`: with
`SMTP_SSL=True` and `SMTP_SSL_SERVER_AUTH=True`, mocks
`superset.utils.core.ssl.create_default_context` and `smtplib.SMTP_SSL`, then
asserts `create_default_context()` is called once and its return value is
threaded through as `SMTP_SSL(..., context=<that context>)`.
- `test_send_mime_email_starttls_server_auth_passes_context`: same idea for
the STARTTLS path — asserts the context is passed to
`smtp.starttls(context=<that context>)`.
- `test_send_mime_email_server_auth_disabled_skips_context`: the opt-out
path — `create_default_context` is not called and `context=None` is passed
through.
So the enabled path is now covered directly (create_default_context called +
context object passed to `SMTP_SSL`/`starttls`), rather than only asserting the
module-level default.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]