예제 #1
0
class ColoredStdOutLoggerTest (unittest.TestCase):
    def setUp(self):
        self.coloredStdOutLogger = ColoredStdOutLogger(Logger)
        
    def test_should_return_italic_debug_message_when_debug_level_given(self):
        actualMessage = self.coloredStdOutLogger._level_to_string(Logger.DEBUG)
        self.assertEqual(actualMessage, "\x1b[2m[DEBUG]\x1b[0;0m")

    def test_should_return_bold_info_message_when_info_level_given(self):
        actualMessage = self.coloredStdOutLogger._level_to_string(Logger.INFO)
        self.assertEqual(actualMessage, "\x1b[1m[INFO] \x1b[0;0m")

    def test_should_return_brown_and_bold_warning_message_when_warning_level_given(self):
        actualMessage = self.coloredStdOutLogger._level_to_string(Logger.WARN)
        self.assertEqual(actualMessage, "\x1b[1;33m[WARN] \x1b[0;0m")

    def test_should_return_bold_and_red_error_message_when_any_not_defined_level_given(self):
        actualMessage = self.coloredStdOutLogger._level_to_string(-1)
        self.assertEqual(actualMessage, "\x1b[1;31m[ERROR]\x1b[0;0m")
예제 #2
0
 def setUp(self):
     self.coloredStdOutLogger = ColoredStdOutLogger(Logger)