summaryrefslogtreecommitdiff
path: root/test/linter/test_terraform_tfsec.vader
blob: c3a7eae213f91c43b7e2a4a695cdc8fdeb9e29ef (plain)
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
Before:
  call ale#assert#SetUpLinterTest('terraform', 'tfsec')

After:
  call ale#assert#TearDownLinterTest()

Execute(The default command should be correct):
  AssertLinter 'tfsec', ale#Escape('tfsec') . ' --format json'

Execute(The default executable should be configurable):
  let b:ale_terraform_tfsec_executable = '/usr/bin/tfsec'

  AssertLinter '/usr/bin/tfsec', ale#Escape('/usr/bin/tfsec') . ' --format json'

Execute(Overriding options should work):
  let g:ale_terraform_tfsec_executable = '/usr/local/bin/tfsec'
  let g:ale_terraform_tfsec_options = '--minimum-severity MEDIUM'

  AssertLinter '/usr/local/bin/tfsec',
  \ ale#Escape('/usr/local/bin/tfsec') . ' --minimum-severity MEDIUM --format json'

Execute(Configuration yml file should be found):
  call ale#test#SetFilename('../test-files/tfsec/yml/main.tf')

  AssertLinter 'tfsec',
  \ ale#Escape('tfsec')
  \   . ' --config-file '
  \   . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/tfsec/yml/.tfsec/config.yml'))
  \   . ' --format json'

Execute(Configuration json file should be found):
  call ale#test#SetFilename('../test-files/tfsec/json/main.tf')

  AssertLinter 'tfsec',
  \ ale#Escape('tfsec')
  \   . ' --config-file '
  \   . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/tfsec/json/.tfsec/config.json'))
  \   . ' --format json'