|
|
@@ -1020,9 +1020,6 @@ fire: hot
|
1020
|
1020
|
|
1021
|
1021
|
describe "checking with http basic auth" do
|
1022
|
1022
|
before do
|
1023
|
|
- stub_request(:any, /example/).
|
1024
|
|
- with(headers: { 'Authorization' => "Basic #{['user:pass'].pack('m').chomp}" }).
|
1025
|
|
- to_return(:body => File.read(Rails.root.join("spec/data_fixtures/xkcd.html")), :status => 200)
|
1026
|
1023
|
@valid_options = {
|
1027
|
1024
|
'name' => "XKCD",
|
1028
|
1025
|
'expected_update_period_in_days' => "2",
|
|
|
@@ -1039,6 +1036,16 @@ fire: hot
|
1039
|
1036
|
@checker = Agents::WebsiteAgent.new(:name => "auth", :options => @valid_options)
|
1040
|
1037
|
@checker.user = users(:bob)
|
1041
|
1038
|
@checker.save!
|
|
1039
|
+
|
|
1040
|
+ case @checker.faraday_backend
|
|
1041
|
+ when :typhoeus
|
|
1042
|
+ # Webmock's typhoeus adapter does not read the Authorization
|
|
1043
|
+ # header: https://github.com/bblimke/webmock/pull/592
|
|
1044
|
+ stub_request(:any, "www.example.com").
|
|
1045
|
+ with(headers: { 'Authorization' => "Basic #{['user:pass'].pack('m0')}" })
|
|
1046
|
+ else
|
|
1047
|
+ stub_request(:any, "user:pass@www.example.com")
|
|
1048
|
+ end.to_return(body: File.read(Rails.root.join("spec/data_fixtures/xkcd.html")), status: 200)
|
1042
|
1049
|
end
|
1043
|
1050
|
|
1044
|
1051
|
describe "#check" do
|