Esempio n. 1
0
    def test_notify(self):
        """Verify basics of the notify function
        """
        out = StringIO()

        message = "Test message"
        notify(message, out=out)
        #options = {}

        output = out.getvalue().strip()
        #print "DEBUG: {0}".format(output)
        assert output.startswith(message)
Esempio n. 2
0
    def test_notify(self):
        """Verify basics of the notify function
        """
        out = StringIO()

        message = "Test message"
        notify(message, out=out)
        #options = {}

        output = out.getvalue().strip()
        #print "DEBUG: {0}".format(output)
        assert output.startswith(message)
Esempio n. 3
0
    def test_notify_snmp(self, mock_log, mock_send_trap):
        """Verify notify with SNMP
        """
        out = StringIO()

        #snmp_settings = {'traphost': 'localhost',
        #                 'version': '3',
        #                 'secname': 'eosplus',
        #                 'seclevel': 'authPriv',
        #                 'authprotocol': 'MD5',
        #                 'authpassword': '******',
        #                 'privprotocol': 'DES',
        #                 'privpassword': '******'
        #                }

        message = "Test message"
        notify(message, out=out)

        output = out.getvalue().strip()
        #print "DEBUG: {0}".format(output)
        assert output.startswith(message)
        #mock_send_trap.assert_called_with(message)
        mock_send_trap.assert_called()
Esempio n. 4
0
    def test_notify_snmp(self, mock_log, mock_send_trap):
        """Verify notify with SNMP
        """
        out = StringIO()

        #snmp_settings = {'traphost': 'localhost',
        #                 'version': '3',
        #                 'secname': 'eosplus',
        #                 'seclevel': 'authPriv',
        #                 'authprotocol': 'MD5',
        #                 'authpassword': '******',
        #                 'privprotocol': 'DES',
        #                 'privpassword': '******'
        #                }

        message = "Test message"
        notify(message, out=out)

        output = out.getvalue().strip()
        #print "DEBUG: {0}".format(output)
        assert output.startswith(message)
        #mock_send_trap.assert_called_with(message)
        mock_send_trap.assert_called()