From fe9a23419f9a875a98fc05dc22e2ad6c5f6dbe3b Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 30 Jun 2016 13:47:40 +0200 Subject: actually use celluloid io for http requests --- lib/nickserver/adapters/celluloid_http.rb | 6 +++--- test/integration/hkp_test.rb | 12 ++++++++++++ test/unit/adapters/celluloid_http_test.rb | 12 +++++++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/lib/nickserver/adapters/celluloid_http.rb b/lib/nickserver/adapters/celluloid_http.rb index 5772bd1..5ded702 100644 --- a/lib/nickserver/adapters/celluloid_http.rb +++ b/lib/nickserver/adapters/celluloid_http.rb @@ -4,12 +4,12 @@ require 'http' module Nickserver::Adapters class CelluloidHttp - # include Celluloid::IO + include Celluloid::IO def get(url, options = {}) response = HTTP.get url, - params: options[:query] - # ssl_socket_class: Celluloid::IO::SSLSocket + params: options[:query], + ssl_socket_class: Celluloid::IO::SSLSocket yield response.code, response.to_s end diff --git a/test/integration/hkp_test.rb b/test/integration/hkp_test.rb index cbb8190..586b3ab 100644 --- a/test/integration/hkp_test.rb +++ b/test/integration/hkp_test.rb @@ -1,9 +1,21 @@ require 'test_helper' require 'nickserver/hkp/source' require 'nickserver/adapters/celluloid_http' +require 'celluloid/test' class HkpTest < Minitest::Test + def setup + super + Celluloid.boot + end + + def teardown + Celluloid.shutdown + super + end + + def test_key_info_expired fetch_key_info(:hkp_vindex_result, 'lemur@leap.se') do |keys| assert_equal 1, keys.length, 'should find a single key' diff --git a/test/unit/adapters/celluloid_http_test.rb b/test/unit/adapters/celluloid_http_test.rb index 64c7a5d..c3c58b1 100644 --- a/test/unit/adapters/celluloid_http_test.rb +++ b/test/unit/adapters/celluloid_http_test.rb @@ -1,9 +1,19 @@ require 'test_helper' require 'nickserver/adapters/celluloid_http' -require 'byebug' +require 'celluloid/test' class Nickserver::Adapters::CelluloidHttpTest < Minitest::Test + def setup + super + Celluloid.boot + end + + def teardown + Celluloid.shutdown + super + end + def test_successful_request url = 'http://url.to' stub_http_request(:get, url) -- cgit v1.2.3