inspec/test/unit/resources/mssql_session_test.rb

22 lines
770 B
Ruby
Raw Normal View History

# 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