bugfixing and rspec tests
This commit is contained in:
9
spec/fixtures/wpscan/wp_version/opml/wp-links-opml-nogenerator.xml
vendored
Normal file
9
spec/fixtures/wpscan/wp_version/opml/wp-links-opml-nogenerator.xml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<opml version="1.0">
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<dateCreated>Mon, 24 Sep 2012 15:58:41 GMT</dateCreated>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</opml>
|
||||
10
spec/fixtures/wpscan/wp_version/opml/wp-links-opml.xml
vendored
Normal file
10
spec/fixtures/wpscan/wp_version/opml/wp-links-opml.xml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<opml version="1.0">
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<dateCreated>Mon, 24 Sep 2012 15:58:41 GMT</dateCreated>
|
||||
<!-- generator="WordPress/3.4.2" -->
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</opml>
|
||||
@@ -221,4 +221,27 @@ describe WpTarget do
|
||||
@expected = true
|
||||
end
|
||||
end
|
||||
|
||||
describe "#search_replace_db_2_url" do
|
||||
it "should return the correct url" do
|
||||
@wp_target.search_replace_db_2_url.should == "http://example.localhost/searchreplacedb2.php"
|
||||
end
|
||||
end
|
||||
|
||||
describe "#search_replace_db_2_exists?" do
|
||||
it "should return true" do
|
||||
stub_request(:any, @wp_target.search_replace_db_2_url).to_return(:status => 200, :body => "asdf by interconnect asdf")
|
||||
@wp_target.search_replace_db_2_exists?.should be_true
|
||||
end
|
||||
|
||||
it "should return false" do
|
||||
stub_request(:any, @wp_target.search_replace_db_2_url).to_return(:status => 500)
|
||||
@wp_target.search_replace_db_2_exists?.should be_false
|
||||
end
|
||||
|
||||
it "should return false" do
|
||||
stub_request(:any, @wp_target.search_replace_db_2_url).to_return(:status => 500, :body => "asdf by interconnect asdf")
|
||||
@wp_target.search_replace_db_2_exists?.should be_false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -139,7 +139,7 @@ describe WpVersion do
|
||||
end
|
||||
|
||||
describe "#find_from_advanced_fingerprinting" do
|
||||
let(:fixtures_dir) { SPEC_FIXTURES_WPSCAN_WP_VERSION_DIR + '/advanced' }
|
||||
let(:fixtures_dir) { SPEC_FIXTURES_WPSCAN_WP_VERSION_DIR + "/advanced" }
|
||||
|
||||
it "should return 3.2.1" do
|
||||
stub_request_to_fixture(:url => @target_uri.merge("wp-admin/js/wp-fullscreen.js").to_s,
|
||||
@@ -152,6 +152,26 @@ describe WpVersion do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#find_from_links_opml" do
|
||||
let(:fixtures_dir) { SPEC_FIXTURES_WPSCAN_WP_VERSION_DIR + "/opml" }
|
||||
|
||||
it "should return 3.4.2" do
|
||||
stub_request_to_fixture(:url => @target_uri.merge("wp-links-opml.php").to_s,
|
||||
:status => 200,
|
||||
:fixture => "#{fixtures_dir}/wp-links-opml.xml")
|
||||
version = WpVersion.find_from_links_opml(:base_url => @target_uri)
|
||||
version.should == "3.4.2"
|
||||
end
|
||||
|
||||
it "should return nil" do
|
||||
stub_request_to_fixture(:url => @target_uri.merge("wp-links-opml.php").to_s,
|
||||
:status => 200,
|
||||
:fixture => "#{fixtures_dir}/wp-links-opml-nogenerator.xml")
|
||||
version = WpVersion.find_from_links_opml(:base_url => @target_uri)
|
||||
version.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "#initialize" do
|
||||
it "should initialize a WpVersion object" do
|
||||
v = WpVersion.new(1, {:discovery_method => "method", :vulns_file => "asdf.xml"})
|
||||
|
||||
Reference in New Issue
Block a user