Fix rspecs

bug/bundler_fix
wchen-r7 2016-12-08 16:11:06 -06:00
parent b537146393
commit ce5c1f07c3
5 changed files with 49 additions and 2 deletions

View File

@ -294,7 +294,7 @@ module Metasploit
if !(cred_details.pass_file.present? || cred_details.username.present? || cred_details.user_file.present? ||
cred_details.userpass_file.present? || !cred_details.additional_publics.empty?)
errors.add(:cred_details, 'No credentials provided')
errors.add(:cred_details, "can't be blank")
end
end

View File

@ -47,6 +47,16 @@ RSpec.describe Metasploit::Framework::LoginScanner::SMB do
it { is_expected.to respond_to :smb_pipe_evasion }
context 'validations' do
before(:each) do
creds = double('Metasploit::Framework::CredentialCollection')
allow(creds).to receive(:pass_file)
allow(creds).to receive(:username)
allow(creds).to receive(:user_file)
allow(creds).to receive(:userpass_file)
allow(creds).to receive(:additional_publics).and_return([])
login_scanner.cred_details = creds
end
context '#smb_verify_signature' do
it 'is not valid for the string true' do
login_scanner.smb_verify_signature = 'true'

View File

@ -65,6 +65,16 @@ RSpec.shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | opts
it { is_expected.to respond_to :proxies }
it { is_expected.to respond_to :stop_on_success }
before do
creds = double('Metasploit::Framework::CredentialCollection')
allow(creds).to receive(:pass_file)
allow(creds).to receive(:username)
allow(creds).to receive(:user_file)
allow(creds).to receive(:userpass_file)
allow(creds).to receive(:additional_publics).and_return([])
login_scanner.cred_details = creds
end
context 'validations' do
context 'port' do
@ -165,7 +175,14 @@ RSpec.shared_examples_for 'Metasploit::Framework::LoginScanner::Base' do | opts
end
it 'is not valid for a non-array input' do
login_scanner.cred_details = rand(10)
creds = double('Metasploit::Framework::CredentialCollection')
allow(creds).to receive(:pass_file)
allow(creds).to receive(:pass_file)
allow(creds).to receive(:username)
allow(creds).to receive(:user_file)
allow(creds).to receive(:userpass_file)
allow(creds).to receive(:additional_publics).and_return([])
login_scanner.cred_details = creds
expect(login_scanner).to_not be_valid
expect(login_scanner.errors[:cred_details]).to include "must respond to :each"
end

View File

@ -11,6 +11,16 @@ RSpec.shared_examples_for 'Metasploit::Framework::LoginScanner::NTLM' do
context 'validations' do
before(:each) do
creds = double('Metasploit::Framework::CredentialCollection')
allow(creds).to receive(:pass_file)
allow(creds).to receive(:username)
allow(creds).to receive(:user_file)
allow(creds).to receive(:userpass_file)
allow(creds).to receive(:additional_publics).and_return([])
login_scanner.cred_details = creds
end
context '#send_lm' do
it 'is not valid for the string true' do
login_scanner.send_lm = 'true'

View File

@ -5,6 +5,16 @@ RSpec.shared_examples_for 'Metasploit::Framework::Tcp::Client' do
it { is_expected.to respond_to :send_delay }
it { is_expected.to respond_to :max_send_size }
before(:example) do
creds = double('Metasploit::Framework::CredentialCollection')
allow(creds).to receive(:pass_file)
allow(creds).to receive(:username)
allow(creds).to receive(:user_file)
allow(creds).to receive(:userpass_file)
allow(creds).to receive(:additional_publics).and_return([])
login_scanner.cred_details = creds
end
context 'send_delay' do
it 'is not valid for a non-number' do
login_scanner.send_delay = "a"