inspec/test/unit/resources/mysql_session_test.rb
Miah Johnson 659b4b373a Remove # encoding: utf8 magic comments
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-07 16:06:23 -07:00

17 lines
752 B
Ruby

# author: Christoph Hartmann
# author: Dominik Richter
require 'helper'
describe 'Inspec::Resources::MysqlSession' do
it 'verify mysql_session escaped login details with single quotes correctly' do
resource = load_resource('mysql_session',
'root',
%q{'%"'"&^*&()'*%})
_(resource.send(:create_mysql_cmd, 'SELECT 1 FROM DUAL;').must_equal(%q{mysql -uroot -p\'\%\"\'\"\&\^\*\&\(\)\'\*\% -h localhost -s -e "SELECT 1 FROM DUAL;"}))
end
it 'verify mysql_session omits optional username and password' do
resource = load_resource('mysql_session')
_(resource.send(:create_mysql_cmd, 'SELECT 1 FROM DUAL;').must_equal('mysql -h localhost -s -e "SELECT 1 FROM DUAL;"'))
end
end