File size: 1,885 Bytes
b40c49c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | """
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import subprocess
from test.integration import BaseCliTestCase
class TestFormatters(BaseCliTestCase):
"""Test Formatters"""
def test_junit(self):
"""Test JUnit formatting"""
result = subprocess.check_output(
[
"cfn-lint",
"--format",
"junit",
"--",
"test/fixtures/templates/good/core/config_only_*.yaml",
]
)
if isinstance(result, bytes):
result = result.decode("utf8")
self.assertIn(
(
'<testcase name="I1002 Validate approaching the template size limit"'
' url="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html"/>'
),
result,
)
self.assertIn(
(
'<testcase name="I1003 Validate if we are approaching the '
'max size of a description" '
'url="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html"/>'
),
result,
)
def test_pretty(self):
"""Test pretty formatting"""
result = subprocess.check_output(
[
"cfn-lint",
"--format",
"pretty",
"--",
"test/fixtures/templates/good/core/config_only_*.yaml",
]
)
if isinstance(result, bytes):
result = result.decode("utf8")
self.assertEqual(
(
"Cfn-lint scanned 2 templates against 2 rules and found 0 errors, 0"
" warnings, and 0 informational violations"
),
result.strip(),
)
|