mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Formatting cleanup.
This commit is contained in:
parent
ef6859e8b0
commit
9d7667ff3e
1 changed files with 16 additions and 9 deletions
|
@ -3,16 +3,23 @@ require 'pathname'
|
||||||
module HTTParty
|
module HTTParty
|
||||||
module SSLTestHelper
|
module SSLTestHelper
|
||||||
def ssl_verify_test(mode, ca_basename, server_cert_filename)
|
def ssl_verify_test(mode, ca_basename, server_cert_filename)
|
||||||
path = Pathname(__FILE__).join('..', '..', 'fixtures', 'ssl', 'generated').expand_path
|
test_server = nil
|
||||||
options = {
|
begin
|
||||||
:format => :json,
|
test_server = SSLTestServer.new(
|
||||||
:timeout => 30,
|
:rsa_key => File.read(File.expand_path("../../fixtures/ssl/generated/server.key", __FILE__)),
|
||||||
}
|
:cert => File.read(File.expand_path("../../fixtures/ssl/generated/#{server_cert_filename}", __FILE__)))
|
||||||
|
|
||||||
|
test_server.start
|
||||||
|
|
||||||
if mode
|
if mode
|
||||||
ca_path = path.join(ca_basename)
|
ca_path = File.expand_path("../../fixtures/ssl/generated/#{ca_basename}", __FILE__)
|
||||||
raise ArgumentError.new("#{ca_path} does not exist") unless ca_path.exist?
|
raise ArgumentError.new("#{ca_path} does not exist") unless File.exist?(ca_path)
|
||||||
options[mode] = ca_path.to_s
|
return HTTParty.get("https://localhost:#{test_server.port}/", :format => :json, :timeout => 30, mode => ca_path)
|
||||||
|
else
|
||||||
|
return HTTParty.get("https://localhost:#{test_server.port}/", :format => :json, :timeout => 30)
|
||||||
|
end
|
||||||
|
ensure
|
||||||
|
test_server.stop if test_server
|
||||||
end
|
end
|
||||||
|
|
||||||
test_server = SSLTestServer.new({
|
test_server = SSLTestServer.new({
|
||||||
|
|
Loading…
Reference in a new issue