First pass at all test working, added travis ci build

GSoC/Meterpreter_Web_Console
christopher lee 2018-04-26 15:12:53 -05:00
parent 071a191055
commit 195b405d69
3 changed files with 23 additions and 7 deletions

View File

@ -18,6 +18,7 @@ rvm:
env:
- CMD='bundle exec rake rspec-rerun:spec SPEC_OPTS="--tag content"'
- CMD='bundle exec rake rspec-rerun:spec SPEC_OPTS="--tag ~content"'
- CMD='bundle exec rake rspec-rerun:spec REMOTE_DB=1'
matrix:
fast_finish: true

View File

@ -2,6 +2,10 @@ require 'spec_helper'
RSpec.describe Msf::Exploit::AutoTarget do
if ENV['REMOTE_DB']
before {skip("Uses factory bot and doesn't directly test DB API")}
end
include_context 'Msf::DBManager'
include_context 'Metasploit::Framework::Spec::Constants cleaner'

View File

@ -212,7 +212,7 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Db do
]
end
end
describe "-S" do
describe "-p" do
before(:example) do
@services = []
@services << framework.db.report_service({host: '192.168.0.1', port: 1024, name: 'service1', proto: 'udp'})
@ -230,7 +230,7 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Db do
end
it "should list services that are on a given port" do
db.cmd_services "-S", "1024|1025"
db.cmd_services "-p", "1024, 1025"
expect(@output).to match_array [
"Services",
"========",
@ -245,10 +245,21 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Db do
describe "-np" do
before(:example) do
framework.db.report_service({host: '192.168.0.1', port: 1024})
framework.db.report_service({host: '192.168.0.1', port: 1025})
framework.db.report_service({host: '192.168.0.1', port: 1026})
@services = []
@services << framework.db.report_service({host: '192.168.0.2', port: 1024})
@services << framework.db.report_service({host: '192.168.0.2', port: 1025})
@services << framework.db.report_service({host: '192.168.0.2', port: 1026})
end
after(:example) do
ids = []
@services.each{|service|
ids << service.id
}
framework.db.delete_service({ids: ids})
end
it "should list services that are not on a given port" do
skip {
db.cmd_services "-np", "1024"
@ -259,8 +270,8 @@ RSpec.describe Msf::Ui::Console::CommandDispatcher::Db do
"",
"host port proto name state info",
"---- ---- ----- ---- ----- ----",
"192.168.0.1 1025 snmp open ",
"192.168.0.1 1026 snmp open "
"192.168.0.2 1025 snmp open ",
"192.168.0.2 1026 snmp open "
]
}
end