forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint_test.py
35 lines (30 loc) · 1.12 KB
/
lint_test.py
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
import unittest
from unittest.mock import patch
from test_framework.shell import SpyShell, RunResult, FakeCommand
import lint
from lint import main
from click.testing import CliRunner
class HelmLintTestCase(unittest.TestCase):
def testHelm(self) -> None:
error = (
b"[ERROR] templates/: parse error at (testnet-addons/templates/load"
b"test.yaml:75): function alkajsdfl not defined"
)
shell = SpyShell(
[
FakeCommand("helm lint testsuite/fixtures/helm", RunResult(0, error)),
]
)
with patch.object(lint, "LocalShell", lambda *_: shell):
runner = CliRunner()
result = runner.invoke(
main,
["--no-log-metadata", "helm", "testsuite/fixtures/helm"],
catch_exceptions=False,
)
shell.assert_commands(self)
expected_error = (
"::error file=testsuite/fixtures/testnet-addons/templates/loadtest."
"yaml,line=75,col=1::function alkajsdfl not defined\n"
)
self.assertEqual(result.output, expected_error)