inspec/test/unit/resources/mssql_session_test.rb
Christoph Hartmann 0839be50d6 oracle_session and mssql_session improvement (#1857)
* improve database parsing
* support sqlcli
* ensure headers are downcast
* externalize database helper
* use password as argument
* feedback from @adamleff
* inline docs update + linting
* stay backwards compatible
* implement tests
2017-06-29 11:01:32 -04:00

21 lines
770 B
Ruby

# encoding: utf-8
# author: Nolan Davidson
# author: Christoph Hartmann
require 'helper'
describe 'Inspec::Resources::MssqlSession' do
it 'verify mssql_session configuration' do
resource = load_resource('mssql_session', user: 'sa', password: 'yourStrong(!)Password', host: 'localhost')
_(resource.user).must_equal 'sa'
_(resource.password).must_equal 'yourStrong(!)Password'
_(resource.host).must_equal 'localhost'
end
it 'run a SQL query' do
resource = load_resource('mssql_session', user: 'sa', password: 'yourStrong(!)Password', host: 'localhost')
query = resource.query("SELECT SERVERPROPERTY('ProductVersion') as result")
_(query.size).must_equal 1
_(query.row(0).column('result').value).must_equal '14.0.600.250'
end
end