inspec/test/unit/resources/mysql_session_test.rb
Ryan Davis bb49d58cd9 Switched chefstyle back to Layout/AlignArguments=with_first_argument.
Fixed the flags mostly with `chefstyle -a` but also refactored/cleaned
some stuff by hand.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 12:57:43 -08:00

20 lines
779 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