Skip to content

Commit

Permalink
add missing mocks for smb session tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-r7 committed Feb 28, 2024
1 parent db87cfa commit 2951b49
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

RSpec.describe Rex::Post::SMB::Ui::Console::CommandDispatcher::Core do
let(:client) { instance_double(RubySMB::Client) }
let(:simple_client) { instance_double(Rex::Proto::SMB::SimpleClient) }
let(:dispatcher) { instance_double(RubySMB::Dispatcher::Socket) }
let(:socket) { instance_double(IO) }
let(:session) { Msf::Sessions::SMB.new(nil, { client: client }) }
let(:console) do
console = Rex::Post::SMB::Ui::Console.new(session)
Expand All @@ -13,6 +16,9 @@
end

before(:each) do
allow(client).to receive(:dispatcher).and_return(dispatcher)
allow(dispatcher).to receive(:tcp_socket).and_return(socket)
allow(Rex::Proto::SMB::SimpleClient).to receive(:new).and_return(simple_client)
allow(session).to receive(:client).and_return(client)
allow(session).to receive(:console).and_return(console)
allow(session).to receive(:name).and_return('test client name')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

RSpec.describe Rex::Post::SMB::Ui::Console::CommandDispatcher::Shares do
let(:client) { instance_double(RubySMB::Client) }
let(:simple_client) { instance_double(Rex::Proto::SMB::SimpleClient) }
let(:dispatcher) { instance_double(RubySMB::Dispatcher::Socket) }
let(:socket) { instance_double(IO) }
let(:session) { Msf::Sessions::SMB.new(nil, { client: client }) }
let(:console) do
console = Rex::Post::SMB::Ui::Console.new(session)
Expand All @@ -14,6 +17,9 @@
end

before(:each) do
allow(client).to receive(:dispatcher).and_return(dispatcher)
allow(dispatcher).to receive(:tcp_socket).and_return(socket)
allow(Rex::Proto::SMB::SimpleClient).to receive(:new).and_return(simple_client)
allow(session).to receive(:client).and_return(client)
allow(session).to receive(:console).and_return(console)
allow(session).to receive(:name).and_return('test client name')
Expand Down

0 comments on commit 2951b49

Please sign in to comment.