Example #1
0
    def test_Logging_Basic_002_01(self):
        """Test if options can be modified from MythTV.MythLog."""

        m = MythLog('simple_test')

        m._setmask("most")
        # check the modified mask:
        self.assertEqual(m._MASK, LOGMASK.MOST)
        # check the default level:
        self.assertEqual(m._LEVEL, LOGLEVEL.INFO)
        # check the default file:
        self.assertTrue('stdout' in repr(m._LOGFILE))

        m._setlevel("notice")
        # check the modified mask:
        self.assertEqual(m._MASK, LOGMASK.MOST)
        # check the modified level:
        self.assertEqual(m._LEVEL, LOGLEVEL.NOTICE)
        # check the default file:
        self.assertTrue('stdout' in repr(m._LOGFILE))

        m._setfile("/tmp/my_logfile")
        # check the modified mask:
        self.assertEqual(m._MASK, LOGMASK.MOST)
        # check the modified level:
        self.assertEqual(m._LEVEL, LOGLEVEL.NOTICE)
        # check the modified file:
        self.assertTrue(os.path.exists("/tmp/my_logfile"))
Example #2
0
    def test_Logging_Basic_004_01(self):
        """"Test if setting options works without a MythLog instance."""

        MythLog._setmask("most")
        # check the modified mask:
        self.assertEqual(MythLog._MASK, LOGMASK.MOST)
        # check the default level:
        self.assertEqual(MythLog._LEVEL, LOGLEVEL.INFO)
        # check the default file:
        self.assertTrue('stdout' in repr(MythLog._LOGFILE))

        MythLog._setlevel("notice")
        # check the modified mask:
        self.assertEqual(MythLog._MASK, LOGMASK.MOST)
        # check the modified level:
        self.assertEqual(MythLog._LEVEL, LOGLEVEL.NOTICE)
        # check the default file:
        self.assertTrue('stdout' in repr(MythLog._LOGFILE))

        MythLog._setfile("/tmp/my_logfile")
        # check the modified mask:
        self.assertEqual(MythLog._MASK, LOGMASK.MOST)
        # check the modified level:
        self.assertEqual(MythLog._LEVEL, LOGLEVEL.NOTICE)
        # check the modified file:
        self.assertTrue(os.path.exists("/tmp/my_logfile"))