Add minimal tests for get/getg
parent
ba2c33132b
commit
da1c56a65d
|
@ -2317,6 +2317,12 @@ class Core
|
|||
global = true
|
||||
end
|
||||
|
||||
# No arguments? No cookie.
|
||||
if args.empty?
|
||||
global ? cmd_getg_help : cmd_get_help
|
||||
return false
|
||||
end
|
||||
|
||||
# Determine which data store we're operating on
|
||||
if (active_module && !global)
|
||||
datastore = active_module.datastore
|
||||
|
@ -2324,12 +2330,6 @@ class Core
|
|||
datastore = framework.datastore
|
||||
end
|
||||
|
||||
# No arguments? No cookie.
|
||||
if args.empty?
|
||||
global ? cmd_getg_help : cmd_get_help
|
||||
return false
|
||||
end
|
||||
|
||||
args.each { |var| print_line("#{var} => #{datastore[var]}") }
|
||||
end
|
||||
|
||||
|
|
|
@ -95,4 +95,25 @@ describe Msf::Ui::Console::CommandDispatcher::Core do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
it { is_expected.to respond_to :cmd_get }
|
||||
it { is_expected.to respond_to :cmd_getg }
|
||||
|
||||
describe "#cmd_get" do
|
||||
describe "without arguments" do
|
||||
it "should show a help message" do
|
||||
core.cmd_get
|
||||
@output.join.should =~ /Usage: get /
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#cmd_getg" do
|
||||
describe "without arguments" do
|
||||
it "should show a help message" do
|
||||
core.cmd_getg
|
||||
@output.join.should =~ /Usage: getg /
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue