mechanize.cr/spec/http_auth_spec.cr

19 lines
630 B
Crystal
Raw Normal View History

2021-12-01 12:29:36 +01:00
require "./spec_helper"
2022-01-04 01:53:04 +01:00
require "./server.cr"
#WebMock.stub(:get, "http://auth.example.com/")
# .with(headers: {"Authorization" => "Basic #{Base64.strict_encode("user:pass").chomp}"})
# .to_return(status: 200)
#
#WebMock.stub(:get, "http://auth.example.com/")
# .to_return(status: 401, headers: {"WWW-Authenticate" => "Basic realm=\"Access to the staging site\", charset=\"UTF-8\""})
2021-12-01 12:29:36 +01:00
describe "Mechanize HTTP Authentication test" do
2022-01-04 01:53:04 +01:00
WebMock.allow_net_connect = true
it "auth" do
agent = Mechanize.new
page = agent.get("#{TEST_SERVER_URL}/secret")
p page.body
WebMock.allow_net_connect = false
end
2021-12-01 12:29:36 +01:00
end