Moves Models into their own namespace - Ref #1315
This commit is contained in:
@@ -29,13 +29,13 @@ describe WPScan::Controller::Core do
|
||||
expect(core.target).to receive(:server).and_return(@stubbed_server)
|
||||
expect(core.load_server_module).to eql @expected
|
||||
|
||||
[core.target, WPScan::WpItem.new(target_url, core.target)].each do |instance|
|
||||
[core.target, WPScan::Model::WpItem.new(target_url, core.target)].each do |instance|
|
||||
expect(instance).to respond_to(:directory_listing?)
|
||||
expect(instance).to respond_to(:directory_listing_entries)
|
||||
|
||||
# The below doesn't work, the module would have to be removed from the class
|
||||
# TODO: find a way to test this
|
||||
# expect(instance.server).to eql @expected if instance.is_a? WPScan::WpItem
|
||||
# expect(instance.server).to eql @expected if instance.is_a? WPScan::Model::WpItem
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ describe WPScan::Controller::PasswordAttack do
|
||||
|
||||
it 'returns an array with the users' do
|
||||
expected = %w[admin editor].reduce([]) do |a, e|
|
||||
a << CMSScanner::User.new(e)
|
||||
a << WPScan::Model::User.new(e)
|
||||
end
|
||||
|
||||
expect(controller.users).to eql expected
|
||||
@@ -90,7 +90,9 @@ describe WPScan::Controller::PasswordAttack do
|
||||
|
||||
context 'when xmlrpc detected on target' do
|
||||
before do
|
||||
expect(controller.target).to receive(:xmlrpc).and_return(WPScan::XMLRPC.new("#{target_url}/xmlrpc.php"))
|
||||
expect(controller.target)
|
||||
.to receive(:xmlrpc)
|
||||
.and_return(WPScan::Model::XMLRPC.new("#{target_url}/xmlrpc.php"))
|
||||
end
|
||||
|
||||
context 'when single xmlrpc' do
|
||||
@@ -98,7 +100,7 @@ describe WPScan::Controller::PasswordAttack do
|
||||
|
||||
it 'returns the correct object' do
|
||||
expect(controller.attacker).to be_a WPScan::Finders::Passwords::XMLRPC
|
||||
expect(controller.attacker.target).to be_a WPScan::XMLRPC
|
||||
expect(controller.attacker.target).to be_a WPScan::Model::XMLRPC
|
||||
end
|
||||
end
|
||||
|
||||
@@ -107,7 +109,7 @@ describe WPScan::Controller::PasswordAttack do
|
||||
|
||||
it 'returns the correct object' do
|
||||
expect(controller.attacker).to be_a WPScan::Finders::Passwords::XMLRPCMulticall
|
||||
expect(controller.attacker.target).to be_a WPScan::XMLRPC
|
||||
expect(controller.attacker.target).to be_a WPScan::Model::XMLRPC
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -127,7 +129,7 @@ describe WPScan::Controller::PasswordAttack do
|
||||
end
|
||||
|
||||
context 'when xmlrpc not enabled' do
|
||||
let(:xmlrpc) { WPScan::XMLRPC.new("#{target_url}/xmlrpc.php") }
|
||||
let(:xmlrpc) { WPScan::Model::XMLRPC.new("#{target_url}/xmlrpc.php") }
|
||||
|
||||
it 'returns the WpLogin' do
|
||||
expect(xmlrpc).to receive(:enabled?).and_return(false)
|
||||
@@ -138,7 +140,7 @@ describe WPScan::Controller::PasswordAttack do
|
||||
end
|
||||
|
||||
context 'when xmlrpc enabled' do
|
||||
let(:xmlrpc) { WPScan::XMLRPC.new("#{target_url}/xmlrpc.php") }
|
||||
let(:xmlrpc) { WPScan::Model::XMLRPC.new("#{target_url}/xmlrpc.php") }
|
||||
|
||||
before { expect(xmlrpc).to receive(:enabled?).and_return(true) }
|
||||
|
||||
@@ -159,7 +161,7 @@ describe WPScan::Controller::PasswordAttack do
|
||||
expect(controller.target).to receive(:wp_version).and_return(false)
|
||||
|
||||
expect(controller.attacker).to be_a WPScan::Finders::Passwords::XMLRPC
|
||||
expect(controller.attacker.target).to be_a WPScan::XMLRPC
|
||||
expect(controller.attacker.target).to be_a WPScan::Model::XMLRPC
|
||||
end
|
||||
end
|
||||
|
||||
@@ -167,20 +169,20 @@ describe WPScan::Controller::PasswordAttack do
|
||||
before { expect(controller.target).to receive(:wp_version).and_return(wp_version) }
|
||||
|
||||
context 'when WP < 4.4' do
|
||||
let(:wp_version) { WPScan::WpVersion.new('3.8.1') }
|
||||
let(:wp_version) { WPScan::Model::WpVersion.new('3.8.1') }
|
||||
|
||||
it 'returns the XMLRPCMulticall' do
|
||||
expect(controller.attacker).to be_a WPScan::Finders::Passwords::XMLRPCMulticall
|
||||
expect(controller.attacker.target).to be_a WPScan::XMLRPC
|
||||
expect(controller.attacker.target).to be_a WPScan::Model::XMLRPC
|
||||
end
|
||||
end
|
||||
|
||||
context 'when WP >= 4.4' do
|
||||
let(:wp_version) { WPScan::WpVersion.new('4.4') }
|
||||
let(:wp_version) { WPScan::Model::WpVersion.new('4.4') }
|
||||
|
||||
it 'returns the XMLRPC' do
|
||||
expect(controller.attacker).to be_a WPScan::Finders::Passwords::XMLRPC
|
||||
expect(controller.attacker.target).to be_a WPScan::XMLRPC
|
||||
expect(controller.attacker.target).to be_a WPScan::Model::XMLRPC
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -56,7 +56,7 @@ describe WPScan::Controller::WpVersion do
|
||||
context "when --detection-mode #{mode}" do
|
||||
let(:cli_args) { "#{super()} --detection-mode #{mode}" }
|
||||
|
||||
[WPScan::WpVersion.new('4.0')].each do |version|
|
||||
[WPScan::Model::WpVersion.new('4.0')].each do |version|
|
||||
context "when version = #{version}" do
|
||||
let(:stubbed) { version }
|
||||
|
||||
@@ -68,16 +68,16 @@ describe WPScan::Controller::WpVersion do
|
||||
|
||||
context 'when --wp-version-all supplied' do
|
||||
let(:cli_args) { "#{super()} --wp-version-all" }
|
||||
let(:stubbed) { WPScan::WpVersion.new('3.9.1') }
|
||||
let(:stubbed) { WPScan::Model::WpVersion.new('3.9.1') }
|
||||
|
||||
it_calls_the_formatter_with_the_correct_parameter(WPScan::WpVersion.new('3.9.1'))
|
||||
it_calls_the_formatter_with_the_correct_parameter(WPScan::Model::WpVersion.new('3.9.1'))
|
||||
end
|
||||
|
||||
context 'when --wp-version-detection mode supplied' do
|
||||
let(:cli_args) { "#{super()} --detection-mode mixed --wp-version-detection passive" }
|
||||
let(:stubbed) { WPScan::WpVersion.new('4.4') }
|
||||
let(:stubbed) { WPScan::Model::WpVersion.new('4.4') }
|
||||
|
||||
it_calls_the_formatter_with_the_correct_parameter(WPScan::WpVersion.new('4.4'))
|
||||
it_calls_the_formatter_with_the_correct_parameter(WPScan::Model::WpVersion.new('4.4'))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user