mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Mock file_client call in smtp return test
This commit is contained in:
parent
adc8950bbe
commit
280dc9a2b6
@ -17,6 +17,7 @@ from tests.support.mock import NO_MOCK, NO_MOCK_REASON, MagicMock, patch
|
|||||||
|
|
||||||
# Import salt libs
|
# Import salt libs
|
||||||
import salt.returners.smtp_return as smtp
|
import salt.returners.smtp_return as smtp
|
||||||
|
from salt.utils.jinja import SaltCacheLoader
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import gnupg # pylint: disable=unused-import
|
import gnupg # pylint: disable=unused-import
|
||||||
@ -54,7 +55,8 @@ class SMTPReturnerTestCase(TestCase, LoaderModuleMockMixin):
|
|||||||
'gpgowner': '',
|
'gpgowner': '',
|
||||||
'subject': ''}
|
'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)
|
smtp.returner(ret)
|
||||||
self.assertTrue(mocked_smtplib.return_value.sendmail.called)
|
self.assertTrue(mocked_smtplib.return_value.sendmail.called)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user