2017-05-02 14:35:54 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
# author: Nolan Davidson
|
2017-06-29 15:01:32 +00:00
|
|
|
# author: Christoph Hartmann
|
2017-05-02 14:35:54 +00:00
|
|
|
|
|
|
|
require 'helper'
|
|
|
|
|
|
|
|
describe 'Inspec::Resources::MssqlSession' do
|
|
|
|
it 'verify mssql_session configuration' do
|
2017-06-29 15:01:32 +00:00
|
|
|
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'
|
2017-05-02 14:35:54 +00:00
|
|
|
end
|
|
|
|
end
|