Add spec for pass_file
parent
b1136752be
commit
45c26343a1
|
@ -9,12 +9,16 @@ describe Metasploit::Framework::CredentialCollection do
|
|||
username: username,
|
||||
password: password,
|
||||
user_file: user_file,
|
||||
pass_file: pass_file,
|
||||
userpass_file: userpass_file,
|
||||
)
|
||||
end
|
||||
|
||||
let(:username) { "user" }
|
||||
let(:password) { "pass" }
|
||||
let(:user_file) { nil }
|
||||
let(:pass_file) { nil }
|
||||
let(:userpass_file) { nil }
|
||||
|
||||
specify do
|
||||
expect { |b| collection.each(&b) }.to yield_with_args(Metasploit::Framework::Credential)
|
||||
|
@ -37,6 +41,25 @@ describe Metasploit::Framework::CredentialCollection do
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
context "when given a pass_file and username" do
|
||||
let(:password) { nil }
|
||||
let(:pass_file) do
|
||||
filename = "foo"
|
||||
stub_file = StringIO.new("asdf\njkl\n")
|
||||
File.stub(:open).with(filename,/^r/).and_return stub_file
|
||||
|
||||
filename
|
||||
end
|
||||
|
||||
specify do
|
||||
expect { |b| collection.each(&b) }.to yield_successive_args(
|
||||
Metasploit::Framework::Credential.new(public: username, private: "asdf"),
|
||||
Metasploit::Framework::Credential.new(public: username, private: "jkl"),
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue