示例#1
0
    def _test_returner(self, mocked_smtplib, *args):  # pylint: disable=unused-argument
        '''
        Test to see if the SMTP returner sends a message
        '''
        ret = {
            'id': '12345',
            'fun': 'mytest.func',
            'fun_args': 'myfunc args',
            'jid': '54321',
            'return': 'The room is on fire as shes fixing her hair'
        }
        options = {
            'username': '',
            'tls': '',
            'from': '',
            'fields': 'id,fun,fun_args,jid,return',
            'to': '',
            'host': '',
            'renderer': 'jinja|yaml',
            'template': '',
            'password': '',
            'gpgowner': '',
            'subject': ''
        }

        with patch('salt.returners.smtp_return._get_options',
                   MagicMock(return_value=options)):
            smtp.returner(ret)
            self.assertTrue(mocked_smtplib.return_value.sendmail.called)
示例#2
0
    def _test_returner(self, mocked_smtplib):  # pylint: disable=unused-argument
        """
        Test to see if the SMTP returner sends a message
        """
        ret = {
            "id": "12345",
            "fun": "mytest.func",
            "fun_args": "myfunc args",
            "jid": "54321",
            "return": "The room is on fire as shes fixing her hair",
        }
        options = {
            "username": "",
            "tls": "",
            "from": "",
            "fields": "id,fun,fun_args,jid,return",
            "to": "",
            "host": "",
            "renderer": "jinja|yaml",
            "template": "",
            "password": "",
            "gpgowner": "",
            "subject": "",
        }

        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)
示例#3
0
    def _test_returner(self, mocked_smtplib, *args):  # pylint: disable=unused-argument
        '''
        Test to see if the SMTP returner sends a message
        '''
        ret = {'id': '12345',
               'fun': 'mytest.func',
               'fun_args': 'myfunc args',
               'jid': '54321',
               'return': 'The room is on fire as shes fixing her hair'
               }
        options = {'username': '',
                  'tls': '',
                  'from': '',
                  'fields': 'id,fun,fun_args,jid,return',
                  'to': '',
                  'host': '',
                  'renderer': 'yaml',
                  'template': '',
                  'password': '',
                  'gpgowner': '',
                  'subject': ''}

        with patch('salt.returners.smtp_return._get_options', MagicMock(return_value=options)):
            smtp.returner(ret)
            self.assertTrue(mocked_smtplib.return_value.sendmail.called)
示例#4
0
    def test_returner(self, mocked_smtplib):
        '''
        Test to see if the SMTP returner sends a message
        '''
        ret = {'id': '12345',
               'fun': 'mytest.func',
               'fun_args': 'myfunc args',
               'jid': '54321',
               'return': 'The room is on fire as shes fixing her hair'
               }

        with patch.dict(smtp.__salt__, {'config.option': MagicMock()}):
            smtp.returner(ret)
            self.assertTrue(mocked_smtplib.return_value.sendmail.called)
    def test_returner(self, mocked_smtplib):
        '''
        Test to see if the SMTP returner sends a message
        '''
        ret = {'id': '12345',
               'fun': 'mytest.func',
               'fun_args': 'myfunc args',
               'jid': '54321',
               'return': 'The room is on fire as shes fixing her hair'
               }

        with patch.dict(smtp.__salt__, {'config.option': MagicMock()}):
            smtp.returner(ret)
            self.assertTrue(mocked_smtplib.return_value.sendmail.called)