mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
6c19e81a06
Signed-off-by: Miah Johnson <miah@chia-pet.org>
15 lines
697 B
Ruby
15 lines
697 B
Ruby
|
|
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
|