Class: ComplianceCli

Inherits:
Minitest::Test
  • Object
show all
Includes:
CorePluginFunctionalHelper
Defined in:
lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb

Constant Summary

Constants included from CorePluginFunctionalHelper

CorePluginFunctionalHelper::TRAIN_CONNECTION

Instance Method Summary collapse

Methods included from CorePluginFunctionalHelper

#__find_plugin_path_from_caller, #__make_empty_plugin_file_data_structure, #__make_plugin_file_data_structure_with_path, #run_inspec_process, #run_inspec_process_with_this_plugin

Instance Method Details

#test_error_login_with_invalid_urlObject



18
19
20
21
22
# File 'lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb', line 18

def 
  out = run_inspec_process("compliance login")
  assert_equal out.exit_status, 1
  assert_includes out.stderr, 'ERROR: "inspec compliance login" was called with no arguments'
end

#test_error_upload_with_fake_pathObject



36
37
38
39
40
# File 'lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb', line 36

def test_error_upload_with_fake_path
  out = run_inspec_process("compliance upload /path/to/dir")
  assert_equal out.exit_status, 0 # TODO: make this error
  assert_includes out.stdout, "You need to login first with `inspec compliance login`"
end

#test_error_upload_without_argsObject



30
31
32
33
34
# File 'lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb', line 30

def test_error_upload_without_args
  out = run_inspec_process("compliance upload")
  assert_equal out.exit_status, 1
  assert_includes out.stderr, 'ERROR: "inspec compliance upload" was called with no arguments'
end

#test_help_outputObject



6
7
8
9
10
# File 'lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb', line 6

def test_help_output
  out = run_inspec_process("compliance help")
  assert_equal out.exit_status, 0
  assert_includes out.stdout, "inspec compliance exec PROFILE"
end

#test_logout_commandObject



12
13
14
15
16
# File 'lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb', line 12

def test_logout_command
  out = run_inspec_process("compliance logout")
  assert_equal out.exit_status, 0
  assert_includes out.stdout, ""
end

#test_profile_list_without_authObject



24
25
26
27
28
# File 'lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb', line 24

def test_profile_list_without_auth
  out = run_inspec_process("compliance profiles")
  assert_equal out.exit_status, 0 # TODO: make this error
  assert_includes out.stdout, "You need to login first with `inspec compliance login`"
end