Exemple #1
0
    def test_mode_append(self):
        """Function:  test_mode_append

        Description:  Test with append mode setting.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name, mode="a")

        self.assertTrue(log_file.handler)
Exemple #2
0
    def test_mode_default(self):
        """Function:  test_mode_default

        Description:  Test with default mode setting.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name)

        self.assertTrue(log_file.handler)
Exemple #3
0
    def test_default_setting(self):
        """Function:  test_default_setting

        Description:  Test with default settings.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name)

        self.assertEqual(log_file.log.level, 20)
Exemple #4
0
    def test_mode_write(self):
        """Function:  test_mode_write

        Description:  Test with write mode setting.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name, mode="w")

        self.assertTrue(log_file.handler)
Exemple #5
0
    def test_info_setting(self):
        """Function:  test_info_setting

        Description:  Test with info settings.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name, level="INFO")

        self.assertEqual(log_file.log.level, 20)
Exemple #6
0
    def test_debug_setting(self):
        """Function:  test_debug_setting

        Description:  Test with debug settings.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name, level="DEBUG")

        self.assertEqual(log_file.log.level, 10)
Exemple #7
0
    def test_warning_setting(self):
        """Function:  test_warning_setting

        Description:  Test with warning settings.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name, level="WARNING")

        self.assertEqual(log_file.log.level, 30)
Exemple #8
0
    def test_error_setting(self):
        """Function:  test_error_setting

        Description:  Test with error settings.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name, level="ERROR")

        self.assertEqual(log_file.log.level, 40)
Exemple #9
0
    def test_critical_setting(self):
        """Function:  test_critical_setting

        Description:  Test with critical settings.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name, level="CRITICAL")

        self.assertEqual(log_file.log.level, 50)
    def test_default_setting(self):
        """Function:  test_default_setting

        Description:  Test with default settings.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name, level="ERROR")
        log_file.log_err("TEST")

        self.assertEqual(open(self.f_name, 'r').read().count('ERROR TEST'), 1)
Exemple #11
0
    def test_default_setting(self):
        """Function:  test_default_setting

        Description:  Test with default settings.

        Arguments:

        """

        log_file = gen_class.Logger(self.name, self.f_name, level="INFO")
        log_file.log_info("TEST")
        log_file.log_close()

        self.assertEqual(log_file.log.handlers, [])