summaryrefslogtreecommitdiff
path: root/test/handler
diff options
context:
space:
mode:
authoryasuhiroki <yasuhiroki.duck@gmail.com>2018-06-05 01:23:25 +0900
committeryasuhiroki <yasuhiroki.duck@gmail.com>2018-06-12 15:11:53 +0900
commitae25d71fa846df0383232d31768ff934192fe313 (patch)
treecb28acfbb280d31eb42fe6c1405b3a28edc982f1 /test/handler
parent22a9dcd03e3585851c48717c70c7ae7363b6e70c (diff)
downloadale-ae25d71fa846df0383232d31768ff934192fe313.zip
Add linter for AWS CloudFormation template file
Diffstat (limited to 'test/handler')
-rw-r--r--test/handler/test_cfn_python_lint_handler.vader29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/handler/test_cfn_python_lint_handler.vader b/test/handler/test_cfn_python_lint_handler.vader
new file mode 100644
index 00000000..1bbd6388
--- /dev/null
+++ b/test/handler/test_cfn_python_lint_handler.vader
@@ -0,0 +1,29 @@
+Before:
+ runtime! ale_linters/cloudformation/cfn_python_lint.vim
+ call ale#test#SetFilename('sample.template.yaml')
+
+After:
+ call ale#linter#Reset()
+
+Execute(The cfn_python_lint handler should parse items correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 96,
+ \ 'col': 7,
+ \ 'text': 'Property Resources/Sample/Properties/FromPort should be of type Integer',
+ \ 'code': 'E3012',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 97,
+ \ 'col': 7,
+ \ 'text': 'AllowedPattern and/or AllowedValues for Parameter should be specified at Parameters/SampleIpAddress. Example for AllowedPattern "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$"',
+ \ 'code': 'W2509',
+ \ 'type': 'W',
+ \ },
+ \ ],
+ \ ale_linters#cloudformation#cfn_python_lint#Handle(bufnr(''), [
+ \ fnamemodify(tempname(), ':h') . '/sample.template.yaml:96:7:96:15: [E3012] Property Resources/Sample/Properties/FromPort should be of type Integer',
+ \ fnamemodify(tempname(), ':h') . '/sample.template.yaml:97:7:97:15: [W2509] AllowedPattern and/or AllowedValues for Parameter should be specified at Parameters/SampleIpAddress. Example for AllowedPattern "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$"',
+ \ ])