Пример #1
0
class TestFormatter(unittest.TestCase):
    def setUp(self):
        self.rule = AnsibleLintRule()
        self.rule.id = "TCF0001"
        self.formatter = Formatter()

    def test_format_coloured_string(self):
        match = Match(1, "hello", "filename.yml", self.rule, "message")
        result = self.formatter.format(match, True)

    def test_unicode_format_string(self):
        match = Match(1, "hello", "filename.yml", self.rule, u'\U0001f427')
        result = self.formatter.format(match, False)

    def test_dict_format_line(self):
        match = Match(1, {'hello': 'world'}, "filename.yml", self.rule, "xyz")
        result = self.formatter.format(match, True)
Пример #2
0
class TestFormatter(unittest.TestCase):

    def setUp(self):
        self.rule = AnsibleLintRule()
        self.rule.id = "TCF0001"
        self.formatter = Formatter()

    def test_format_coloured_string(self):
        match = Match(1, "hello", "filename.yml", self.rule, "message")
        result = self.formatter.format(match, True)

    def test_unicode_format_string(self):
        match = Match(1, "hello", "filename.yml", self.rule, u'\U0001f427')
        result = self.formatter.format(match, False)

    def test_dict_format_line(self):
        match = Match(1, {'hello': 'world'}, "filename.yml", self.rule, "xyz")
        result = self.formatter.format(match, True)
Пример #3
0
class TestFormatter(unittest.TestCase):
    def setUp(self):
        self.rule = AnsibleLintRule()
        self.rule.id = "TCF0001"
        self.formatter = Formatter(pathlib.Path.cwd(),
                                   display_relative_path=True)

    def test_format_coloured_string(self):
        match = MatchError(message="message",
                           linenumber=1,
                           details="hello",
                           filename="filename.yml",
                           rule=self.rule)
        self.formatter.format(match)

    def test_unicode_format_string(self):
        match = MatchError(message=u'\U0001f427',
                           linenumber=1,
                           details="hello",
                           filename="filename.yml",
                           rule=self.rule)
        self.formatter.format(match)

    def test_dict_format_line(self):
        match = MatchError(
            message="xyz",
            linenumber=1,
            details={'hello': 'world'},
            filename="filename.yml",
            rule=self.rule,
        )
        self.formatter.format(match)
Пример #4
0
class TestFormatter(unittest.TestCase):

    def setUp(self):
        self.rule = AnsibleLintRule()
        self.rule.id = "TCF0001"
        self.formatter = Formatter(pathlib.Path.cwd(), True)

    def test_format_coloured_string(self):
        match = MatchError("message", 1, "hello", "filename.yml", self.rule)
        self.formatter.format(match, True)

    def test_unicode_format_string(self):
        match = MatchError(u'\U0001f427', 1, "hello", "filename.yml", self.rule)
        self.formatter.format(match, False)

    def test_dict_format_line(self):
        match = MatchError("xyz", 1, {'hello': 'world'}, "filename.yml", self.rule,)
        self.formatter.format(match, True)
Пример #5
0
 def setUp(self):
     self.rule = AnsibleLintRule()
     self.rule.id = "TCF0001"
     self.formatter = Formatter(pathlib.Path.cwd(), True)
Пример #6
0
 def test_unicode_formatting(self):
     filename = 'test/unicode.yml'
     runner = ansiblelint.Runner(self.rules, {filename}, [], [], [])
     matches = runner.run()
     formatter = Formatter()
     formatter.format(matches[0])
Пример #7
0
 def setUp(self) -> None:
     self.rule = AnsibleLintRule()
     self.rule.id = "TCF0001"
     self.formatter = Formatter(pathlib.Path.cwd(),
                                display_relative_path=True)
Пример #8
0
 def setUp(self):
     self.rule = AnsibleLintRule()
     self.rule.id = "TCF0001"
     self.formatter = Formatter()
Пример #9
0
 def test_unicode_formatting(self):
     filename = 'test/unicode.yml'
     runner = ansiblelint.Runner(self.rules, {filename}, [], [], [])
     matches = runner.run()
     formatter = Formatter()
     formatter.format(matches[0])
Пример #10
0
 def setUp(self):
     self.rule = AnsibleLintRule()
     self.rule.id = "TCF0001"
     self.formatter = Formatter()