inspec/lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb
Ryan Davis 18ce4850f0 Initial pass to clean up functional testing wrt exit codes and output.
This should get windows tests running again? Hopefully? They're
running SO slowly on my vagrant box that I'm just pushing for now.
They're clean on the mac side.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:06:25 -07:00

53 lines
1.4 KiB
Ruby

require_relative "../../../shared/core_plugin_test_helper.rb"
class ComplianceCli < Minitest::Test
include CorePluginFunctionalHelper
def test_help_output
out = run_inspec_process("compliance help")
assert_includes out.stdout, "inspec compliance exec PROFILE"
assert_exit_code 0, out
end
def test_logout_command
out = run_inspec_process("compliance logout")
assert_includes out.stdout, ""
assert_exit_code 0, out
end
def test_error_login_with_invalid_url
out = run_inspec_process("compliance login")
assert_includes out.stderr, 'ERROR: "inspec compliance login" was called with no arguments'
assert_exit_code 1, out
end
def test_profile_list_without_auth
out = run_inspec_process("compliance profiles")
assert_includes out.stdout, "You need to login first with `inspec compliance login`"
assert_exit_code 0, out # TODO: make this error
end
def test_error_upload_without_args
out = run_inspec_process("compliance upload")
assert_includes out.stderr, 'ERROR: "inspec compliance upload" was called with no arguments'
assert_exit_code 1, out
end
def test_error_upload_with_fake_path
out = run_inspec_process("compliance upload /path/to/dir")
assert_includes out.stdout, "You need to login first with `inspec compliance login`"
assert_exit_code 0, out # TODO: make this error
end
end