Basic auth

This commit is contained in:
erwanlr
2012-12-12 17:05:06 +01:00
parent 962da638b9
commit 2a782e9680
7 changed files with 115 additions and 47 deletions

View File

@@ -57,7 +57,7 @@ shared_examples_for "WebSite" do
it "should return true if the xmlrpc is found" do
stub_request(:get, @module.xmlrpc_url).
to_return(:status => 200, :body => File.new(fixtures_dir + '/xmlrpc.php'))
to_return(:status => 200, :body => File.new(fixtures_dir + '/xmlrpc.php'))
@module.is_wordpress?.should be_true
end
@@ -75,6 +75,18 @@ shared_examples_for "WebSite" do
end
end
describe "#has_basic_auth?" do
it "should detect that the wpsite is basic auth protected" do
stub_request(:get, "http://example.localhost/").to_return(:status => 401)
@module.should have_basic_auth
end
it "should not have a basic auth for a 200" do
stub_request(:get, "http://example.localhost/").to_return(:status => 200)
@module.should_not have_basic_auth
end
end
describe "#redirection" do
it "should return nil if no redirection detected" do
stub_request(:get, @module.url).to_return(:status => 200, :body => '')