36
36
37
37
class TestEmailSmtp (SupersetTestCase ):
38
38
def setUp (self ):
39
- app .config ["smtp_ssl " ] = False
39
+ app .config ["SMTP_SSL " ] = False
40
40
41
41
@mock .patch ("superset.utils.core.send_mime_email" )
42
42
def test_send_smtp (self , mock_send_mime ):
@@ -150,6 +150,8 @@ def test_send_mime_ssl(self, mock_smtp, mock_smtp_ssl):
150
150
@mock .patch ("smtplib.SMTP_SSL" )
151
151
@mock .patch ("smtplib.SMTP" )
152
152
def test_send_mime_noauth (self , mock_smtp , mock_smtp_ssl ):
153
+ smtp_user = app .config ["SMTP_USER" ]
154
+ smtp_password = app .config ["SMTP_PASSWORD" ]
153
155
app .config ["SMTP_USER" ] = None
154
156
app .config ["SMTP_PASSWORD" ] = None
155
157
mock_smtp .return_value = mock .Mock ()
@@ -158,6 +160,8 @@ def test_send_mime_noauth(self, mock_smtp, mock_smtp_ssl):
158
160
assert not mock_smtp_ssl .called
159
161
mock_smtp .assert_called_with (app .config ["SMTP_HOST" ], app .config ["SMTP_PORT" ])
160
162
assert not mock_smtp .login .called
163
+ app .config ["SMTP_USER" ] = smtp_user
164
+ app .config ["SMTP_PASSWORD" ] = smtp_password
161
165
162
166
@mock .patch ("smtplib.SMTP_SSL" )
163
167
@mock .patch ("smtplib.SMTP" )
0 commit comments