2016-04-13 14:54:29 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
# author: Dominik Richter
|
|
|
|
# author: Christoph Hartmann
|
|
|
|
|
|
|
|
require 'functional/helper'
|
|
|
|
|
|
|
|
# basic testing without availability of any server
|
|
|
|
describe 'inspec compliance' do
|
|
|
|
include FunctionalHelper
|
|
|
|
|
|
|
|
it 'help' do
|
|
|
|
out = inspec('compliance help')
|
|
|
|
out.exit_status.must_equal 0
|
|
|
|
out.stdout.must_include 'inspec compliance exec PROFILE'
|
|
|
|
end
|
|
|
|
|
|
|
|
# ensure we are logged out
|
|
|
|
it 'logout' do
|
|
|
|
out = inspec('compliance logout')
|
|
|
|
out.exit_status.must_equal 0
|
|
|
|
out.stdout.must_include ''
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'login server url missing' do
|
|
|
|
out = inspec('compliance login')
|
2018-03-07 15:09:22 +00:00
|
|
|
out.exit_status.must_equal 1
|
2018-03-21 17:44:28 +00:00
|
|
|
out.stderr.must_include 'ERROR: "inspec compliance login" was called with no arguments'
|
2016-04-13 14:54:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'inspec compliance profiles without authentication' do
|
|
|
|
out = inspec('compliance profile')
|
2016-04-29 10:08:45 +00:00
|
|
|
out.stdout.must_include 'You need to login first with `inspec compliance login`'
|
|
|
|
out.exit_status.must_equal 0
|
2016-04-13 14:54:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'try to upload a profile without directory' do
|
|
|
|
out = inspec('compliance upload')
|
2018-03-21 17:44:28 +00:00
|
|
|
out.stderr.must_include 'ERROR: "inspec compliance upload" was called with no arguments'
|
2018-03-07 15:09:22 +00:00
|
|
|
out.exit_status.must_equal 1
|
2016-04-13 14:54:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'try to upload a profile a non-existing path' do
|
|
|
|
out = inspec('compliance upload /path/to/dir')
|
2016-04-29 10:08:45 +00:00
|
|
|
out.stdout.must_include 'You need to login first with `inspec compliance login`'
|
|
|
|
out.exit_status.must_equal 0
|
2016-04-13 14:54:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'logout' do
|
|
|
|
out = inspec('compliance logout')
|
|
|
|
out.exit_status.must_equal 0
|
|
|
|
out.stdout.must_include ''
|
|
|
|
end
|
|
|
|
end
|