Example #1
0
    def test_disbledLogging(self):
        # Don't send emails, and don't write out the log file.
        message  = "test test test"
        notifier = Notifier(test = True, log = False)
        notifier.startLogging()
        notifier.logMessage(message)
        notifier.stopLogging()

        self.assertEquals(None, notifier.logfilename)
Example #2
0
    def test_enabledLogging(self):
        # Don't send emails, but write out the log file.
        message  = "test test test"
        notifier = Notifier(test = True, log = True)
        notifier.startLogging()
        notifier.logMessage(message)
        notifier.stopLogging()

        file     = open(notifier.logfilename, "r")
        contents = file.read()
        self.assertTrue(message in contents)
        self.assertTrue("Notification sent on" in contents)
        file.close()

        os.remove(notifier.logfilename)