Mock file_client call in smtp return test

This commit is contained in:
Ch3LL 2018-02-27 16:36:38 -05:00
parent adc8950bbe
commit 280dc9a2b6
No known key found for this signature in database
GPG Key ID: 132B55A7C13EFA73

View File

@ -17,6 +17,7 @@ from tests.support.mock import NO_MOCK, NO_MOCK_REASON, MagicMock, patch
# Import salt libs
import salt.returners.smtp_return as smtp
from salt.utils.jinja import SaltCacheLoader
try:
import gnupg # pylint: disable=unused-import
@ -54,7 +55,8 @@ class SMTPReturnerTestCase(TestCase, LoaderModuleMockMixin):
'gpgowner': '',
'subject': ''}
with patch('salt.returners.smtp_return._get_options', MagicMock(return_value=options)):
with patch('salt.returners.smtp_return._get_options', MagicMock(return_value=options)), \
patch.object(SaltCacheLoader, 'file_client', MagicMock()):
smtp.returner(ret)
self.assertTrue(mocked_smtplib.return_value.sendmail.called)