Use be_a
parent
9de1c95b22
commit
49b088d112
|
@ -20,7 +20,7 @@ describe Metasploit::Framework::LoginScanner::DB2 do
|
|||
my_scanner.should_receive(:connect).and_raise ::Rex::ConnectionError
|
||||
result = my_scanner.attempt_login(test_cred)
|
||||
expect(result.status).to eq Metasploit::Model::Login::Status::UNABLE_TO_CONNECT
|
||||
expect(result.proof.message).to eq ::Rex::ConnectionError.new.to_s
|
||||
expect(result.proof).to be_a(::Rex::ConnectionError)
|
||||
end
|
||||
|
||||
it 'returns a connection_error result for an Rex::ConnectionTimeout' do
|
||||
|
@ -28,7 +28,7 @@ describe Metasploit::Framework::LoginScanner::DB2 do
|
|||
my_scanner.should_receive(:connect).and_raise ::Rex::ConnectionTimeout
|
||||
result = my_scanner.attempt_login(test_cred)
|
||||
expect(result.status).to eq Metasploit::Model::Login::Status::UNABLE_TO_CONNECT
|
||||
expect(result.proof.message).to eq ::Rex::ConnectionTimeout.new.to_s
|
||||
expect(result.proof).to be_a(::Rex::ConnectionTimeout)
|
||||
end
|
||||
|
||||
it 'returns a connection_error result for an ::Timeout::Error' do
|
||||
|
@ -36,7 +36,7 @@ describe Metasploit::Framework::LoginScanner::DB2 do
|
|||
my_scanner.should_receive(:connect).and_raise ::Timeout::Error
|
||||
result = my_scanner.attempt_login(test_cred)
|
||||
expect(result.status).to eq Metasploit::Model::Login::Status::UNABLE_TO_CONNECT
|
||||
expect(result.proof.message).to eq ::Timeout::Error.new.to_s
|
||||
expect(result.proof).to be_a(::Timeout::Error)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -51,7 +51,7 @@ describe Metasploit::Framework::LoginScanner::MySQL do
|
|||
|
||||
it 'returns a result with the proof containing an appropriate error message' do
|
||||
::RbMysql.should_receive(:connect).and_raise Errno::ECONNREFUSED
|
||||
expect(login_scanner.attempt_login(pub_pub).proof.message).to eq "Connection refused"
|
||||
expect(login_scanner.attempt_login(pub_pub).proof).to be_a(Errno::ECONNREFUSED)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -63,7 +63,7 @@ describe Metasploit::Framework::LoginScanner::MySQL do
|
|||
|
||||
it 'returns a result with the proof containing an appropriate error message' do
|
||||
::RbMysql.should_receive(:connect).and_raise RbMysql::ClientError
|
||||
expect(login_scanner.attempt_login(pub_pub).proof.message).to eq "RbMysql::ClientError"
|
||||
expect(login_scanner.attempt_login(pub_pub).proof).to be_a(RbMysql::ClientError)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -75,7 +75,7 @@ describe Metasploit::Framework::LoginScanner::MySQL do
|
|||
|
||||
it 'returns a result with the proof containing an appropriate error message' do
|
||||
::RbMysql.should_receive(:connect).and_raise Errno::ETIMEDOUT
|
||||
expect(login_scanner.attempt_login(pub_pub).proof.message).to eq "Connection timed out"
|
||||
expect(login_scanner.attempt_login(pub_pub).proof).to be_a(Errno::ETIMEDOUT)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -87,7 +87,7 @@ describe Metasploit::Framework::LoginScanner::MySQL do
|
|||
|
||||
it 'returns a result with the proof containing an appropriate error message' do
|
||||
::RbMysql.should_receive(:connect).and_raise RbMysql::HostNotPrivileged, "Host not privileged"
|
||||
expect(login_scanner.attempt_login(pub_pub).proof.message).to eq "Host not privileged"
|
||||
expect(login_scanner.attempt_login(pub_pub).proof).to be_a(RbMysql::HostNotPrivileged)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -99,7 +99,7 @@ describe Metasploit::Framework::LoginScanner::MySQL do
|
|||
|
||||
it 'returns a result with the proof containing an appropriate error message' do
|
||||
::RbMysql.should_receive(:connect).and_raise RbMysql::AccessDeniedError, "Access Denied"
|
||||
expect(login_scanner.attempt_login(pub_pub).proof.message).to eq "Access Denied"
|
||||
expect(login_scanner.attempt_login(pub_pub).proof).to be_a(RbMysql::AccessDeniedError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue