Skip to content

Commit

Permalink
Fix removing initialize warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
zgoldman-r7 committed Feb 2, 2024
1 parent 35778e9 commit 23e184c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions spec/lib/metasploit/framework/login_scanner/mssql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
let(:client) { instance_double(Rex::Proto::MSSQL::Client) }
it 'returns a result with the connection_error status' do
my_scanner = login_scanner
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:initialize).and_return(client)
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:mssql_login).and_raise ::Rex::ConnectionError
allow(Rex::Proto::MSSQL::Client).to receive(:new).and_return(client)
allow(client).to receive(:mssql_login).and_raise ::Rex::ConnectionError
allow(client).to receive(:disconnect)
expect(my_scanner.attempt_login(pub_blank).status).to eq Metasploit::Model::Login::Status::UNABLE_TO_CONNECT
end
Expand All @@ -94,8 +94,8 @@
let(:client) { instance_double(Rex::Proto::MSSQL::Client) }
it 'returns a result object with a status of Metasploit::Model::Login::Status::INCORRECT' do
my_scanner = login_scanner
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:initialize).and_return(client)
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:mssql_login).and_return(false)
allow(Rex::Proto::MSSQL::Client).to receive(:new).and_return(client)
allow(client).to receive(:mssql_login).and_return(false)
allow(client).to receive(:disconnect)
expect(my_scanner.attempt_login(pub_blank).status).to eq Metasploit::Model::Login::Status::INCORRECT
end
Expand All @@ -105,12 +105,11 @@
let(:client) { instance_double(Rex::Proto::MSSQL::Client) }
it 'returns a result object with a status of Metasploit::Model::Login::Status::SUCCESSFUL' do
my_scanner = login_scanner
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:initialize).and_return(client)
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:mssql_login).and_return(true)
allow(Rex::Proto::MSSQL::Client).to receive(:new).and_return(client)
allow(client).to receive(:mssql_login).and_return(true)
allow(client).to receive(:disconnect)
expect(my_scanner.attempt_login(pub_blank).status).to eq Metasploit::Model::Login::Status::SUCCESSFUL
end
end
end

end

0 comments on commit 23e184c

Please sign in to comment.