1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
From: Matthias Klose <doko@ubuntu.com>
From: Steve Langasek <steve.langasek@ubuntu.com>
From: Paul Gevers <elbrus@debian.org>
Last-Update: 2019-01-13
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818459
Bug-Debian: https://bugs.debian.org/873576
Forwarded: no
Index: ruby-rest-client/spec/integration/request_spec.rb
===================================================================
--- ruby-rest-client.orig/spec/integration/request_spec.rb
+++ ruby-rest-client/spec/integration/request_spec.rb
@@ -10,118 +10,11 @@ describe RestClient::Request do
end
describe "ssl verification" do
- it "is successful with the correct ca_file" do
- request = RestClient::Request.new(
- :method => :get,
- :url => 'https://www.mozilla.org',
- :ssl_ca_file => File.join(File.dirname(__FILE__), "certs", "digicert.crt")
- )
- expect { request.execute }.to_not raise_error
- end
-
- it "is successful with the correct ca_path" do
- request = RestClient::Request.new(
- :method => :get,
- :url => 'https://www.mozilla.org',
- :ssl_ca_path => File.join(File.dirname(__FILE__), "capath_digicert")
- )
- expect { request.execute }.to_not raise_error
- end
-
- # TODO: deprecate and remove RestClient::SSLCertificateNotVerified and just
- # pass through OpenSSL::SSL::SSLError directly. See note in
- # lib/restclient/request.rb.
- #
- # On OS X, this test fails since Apple has patched OpenSSL to always fall
- # back on the system CA store.
- it "is unsuccessful with an incorrect ca_file", :unless => RestClient::Platform.mac_mri? do
- request = RestClient::Request.new(
- :method => :get,
- :url => 'https://www.mozilla.org',
- :ssl_ca_file => File.join(File.dirname(__FILE__), "certs", "verisign.crt")
- )
- expect { request.execute }.to raise_error(RestClient::SSLCertificateNotVerified)
- end
-
- # On OS X, this test fails since Apple has patched OpenSSL to always fall
- # back on the system CA store.
- it "is unsuccessful with an incorrect ca_path", :unless => RestClient::Platform.mac_mri? do
- request = RestClient::Request.new(
- :method => :get,
- :url => 'https://www.mozilla.org',
- :ssl_ca_path => File.join(File.dirname(__FILE__), "capath_verisign")
- )
- expect { request.execute }.to raise_error(RestClient::SSLCertificateNotVerified)
- end
-
- it "is successful using the default system cert store" do
- request = RestClient::Request.new(
- :method => :get,
- :url => 'https://www.mozilla.org',
- :verify_ssl => true,
- )
- expect {request.execute }.to_not raise_error
- end
-
- it "executes the verify_callback" do
- ran_callback = false
- request = RestClient::Request.new(
- :method => :get,
- :url => 'https://www.mozilla.org',
- :verify_ssl => true,
- :ssl_verify_callback => lambda { |preverify_ok, store_ctx|
- ran_callback = true
- preverify_ok
- },
- )
- expect {request.execute }.to_not raise_error
- expect(ran_callback).to eq(true)
- end
-
- it "fails verification when the callback returns false",
- :unless => RestClient::Platform.mac_mri? do
- request = RestClient::Request.new(
- :method => :get,
- :url => 'https://www.mozilla.org',
- :verify_ssl => true,
- :ssl_verify_callback => lambda { |preverify_ok, store_ctx| false },
- )
- expect { request.execute }.to raise_error(RestClient::SSLCertificateNotVerified)
- end
-
- it "succeeds verification when the callback returns true",
- :unless => RestClient::Platform.mac_mri? do
- request = RestClient::Request.new(
- :method => :get,
- :url => 'https://www.mozilla.org',
- :verify_ssl => true,
- :ssl_ca_file => File.join(File.dirname(__FILE__), "certs", "verisign.crt"),
- :ssl_verify_callback => lambda { |preverify_ok, store_ctx| true },
- )
- expect { request.execute }.to_not raise_error
- end
+ # all removed; accessing the network
end
describe "timeouts" do
- it "raises OpenTimeout when it hits an open timeout" do
- request = RestClient::Request.new(
- :method => :get,
- :url => 'http://www.mozilla.org',
- :open_timeout => 1e-10,
- )
- expect { request.execute }.to(
- raise_error(RestClient::Exceptions::OpenTimeout))
- end
-
- it "raises ReadTimeout when it hits a read timeout via :read_timeout" do
- request = RestClient::Request.new(
- :method => :get,
- :url => 'https://www.mozilla.org',
- :read_timeout => 1e-10,
- )
- expect { request.execute }.to(
- raise_error(RestClient::Exceptions::ReadTimeout))
- end
+ # all removed; accessing the network
end
end
Index: ruby-rest-client/spec/integration/httpbin_spec.rb
===================================================================
--- ruby-rest-client.orig/spec/integration/httpbin_spec.rb
+++ ruby-rest-client/spec/integration/httpbin_spec.rb
@@ -40,48 +40,6 @@ describe RestClient::Request do
end
describe '.execute' do
- it 'sends a user agent' do
- data = execute_httpbin_json('user-agent', method: :get)
- expect(data['user-agent']).to match(/rest-client/)
- end
-
- it 'receives cookies on 302' do
- expect {
- execute_httpbin('cookies/set?foo=bar', method: :get, max_redirects: 0)
- }.to raise_error(RestClient::Found) { |ex|
- expect(ex.http_code).to eq 302
- expect(ex.response.cookies['foo']).to eq 'bar'
- }
- end
-
- it 'passes along cookies through 302' do
- data = execute_httpbin_json('cookies/set?foo=bar', method: :get)
- expect(data).to have_key('cookies')
- expect(data['cookies']['foo']).to eq 'bar'
- end
-
- it 'handles quote wrapped cookies' do
- expect {
- execute_httpbin('cookies/set?foo=' + CGI.escape('"bar:baz"'),
- method: :get, max_redirects: 0)
- }.to raise_error(RestClient::Found) { |ex|
- expect(ex.http_code).to eq 302
- expect(ex.response.cookies['foo']).to eq '"bar:baz"'
- }
- end
-
- it 'sends basic auth' do
- user = 'user'
- pass = 'pass'
-
- data = execute_httpbin_json("basic-auth/#{user}/#{pass}", method: :get, user: user, password: pass)
- expect(data).to eq({'authenticated' => true, 'user' => user})
-
- expect {
- execute_httpbin_json("basic-auth/#{user}/#{pass}", method: :get, user: user, password: 'badpass')
- }.to raise_error(RestClient::Unauthorized) { |ex|
- expect(ex.http_code).to eq 401
- }
- end
+ # all removed; accessing the network
end
end
|