2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "inspec/resources/oracledb_session"
|
2017-05-05 13:29:38 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Inspec::Resources::OracledbSession" do
|
|
|
|
it "verify oracledb_session configuration" do
|
|
|
|
resource = load_resource("oracledb_session", user: "SYSTEM", password: "supersecurepass", host: "localhost", service: "ORCL.localdomain")
|
|
|
|
_(resource.user).must_equal "SYSTEM"
|
|
|
|
_(resource.password).must_equal "supersecurepass"
|
|
|
|
_(resource.host).must_equal "localhost"
|
|
|
|
_(resource.service).must_equal "ORCL.localdomain"
|
2017-06-29 15:01:32 +00:00
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "run a SQL query" do
|
|
|
|
resource = load_resource("oracledb_session", user: "SYSTEM", password: "supersecurepass", host: "127.0.0.1", service: "ORCL.localdomain", port: 1527)
|
|
|
|
query = resource.query("SELECT NAME AS VALUE FROM v$database;")
|
2017-06-29 15:01:32 +00:00
|
|
|
_(query.size).must_equal 1
|
2019-06-11 22:24:35 +00:00
|
|
|
_(query.row(0).column("value").value).must_equal "ORCL"
|
2017-05-05 13:29:38 +00:00
|
|
|
end
|
|
|
|
end
|