inspec/test/unit/resources/mysql_session_test.rb
Ryan Davis 07dc5e3192 First pass at cleaning deprecations for old minitest/spec-style tests.
3 files left to go, and they're behaving oddly so I'm leaving them out
in this pass. Looks like 21 deprecations left.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-03 13:45:19 -07:00

16 lines
717 B
Ruby

require "helper"
require "inspec/resource"
require "inspec/resources/mysql_session"
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