rusackas commented on code in PR #41250:
URL: https://github.com/apache/superset/pull/41250#discussion_r3444025730
##########
tests/unit_tests/utils/webdriver_test.py:
##########
@@ -273,6 +273,34 @@ def test_empty_webdriver_config(self, mock_chrome,
mock_app_patch, mock_app):
# Should create driver without errors
mock_driver_class.assert_called_once()
+ @patch("superset.utils.webdriver.app")
+ def test_driver_sets_page_load_timeout(self, mock_app_patch):
Review Comment:
Typed both new webdriver test methods (`mock_app_patch: MagicMock`, `->
None`). Thanks.
##########
tests/integration_tests/email_tests.py:
##########
@@ -281,6 +287,26 @@ def test_send_mime_dryrun(self, mock_smtp, mock_smtp_ssl):
assert not mock_smtp.called
assert not mock_smtp_ssl.called
+ @mock.patch("smtplib.SMTP_SSL")
+ @mock.patch("smtplib.SMTP")
Review Comment:
Annotated the params and return type on this one.
##########
tests/integration_tests/email_tests.py:
##########
@@ -281,6 +287,26 @@ def test_send_mime_dryrun(self, mock_smtp, mock_smtp_ssl):
assert not mock_smtp.called
assert not mock_smtp_ssl.called
+ @mock.patch("smtplib.SMTP_SSL")
+ @mock.patch("smtplib.SMTP")
+ def test_send_mime_respects_custom_timeout(self, mock_smtp, mock_smtp_ssl):
+ # A missing timeout would block the worker forever when the SMTP server
+ # is unreachable, wedging the report schedule in WORKING (issue
#40047).
+ config = {**current_app.config, "SMTP_TIMEOUT": 7, "SMTP_SSL": False}
+ mock_smtp.return_value = mock.Mock()
+ utils.send_mime_email("from", "to", MIMEMultipart(), config,
dryrun=False)
+ assert mock_smtp.call_args.kwargs["timeout"] == 7
+
+ @mock.patch("smtplib.SMTP_SSL")
+ @mock.patch("smtplib.SMTP")
Review Comment:
Done, this one is now fully typed too.
--
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]