Remove the duplicate 'Warning' prefix now that the logger adds the prefix.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
d836973a04
commit
841ed4ed21
5 changed files with 44 additions and 8 deletions
35
tests/unit/cli/formatter_test.py
Normal file
35
tests/unit/cli/formatter_test.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
|
||||
from compose.cli import colors
|
||||
from compose.cli.formatter import ConsoleWarningFormatter
|
||||
from tests import unittest
|
||||
|
||||
|
||||
MESSAGE = 'this is the message'
|
||||
|
||||
|
||||
def makeLogRecord(level):
|
||||
return logging.LogRecord('name', level, 'pathame', 0, MESSAGE, (), None)
|
||||
|
||||
|
||||
class ConsoleWarningFormatterTestCase(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.formatter = ConsoleWarningFormatter()
|
||||
|
||||
def test_format_warn(self):
|
||||
output = self.formatter.format(makeLogRecord(logging.WARN))
|
||||
expected = colors.yellow('WARNING') + ': '
|
||||
assert output == expected + MESSAGE
|
||||
|
||||
def test_format_error(self):
|
||||
output = self.formatter.format(makeLogRecord(logging.ERROR))
|
||||
expected = colors.red('ERROR') + ': '
|
||||
assert output == expected + MESSAGE
|
||||
|
||||
def test_format_info(self):
|
||||
output = self.formatter.format(makeLogRecord(logging.INFO))
|
||||
assert output == MESSAGE
|
||||
Loading…
Add table
Add a link
Reference in a new issue