test/persistence_test.rb in 3scale_client-2.4.2 vs test/persistence_test.rb in 3scale_client-2.5.0.pre1
- old
+ new
@@ -1,17 +1,21 @@
+require 'minitest/autorun'
+
require '3scale/client'
-require 'test/unit'
+require 'mocha/setup'
if ENV['TEST_3SCALE_PROVIDER_KEY'] && ENV['TEST_3SCALE_APP_IDS'] && ENV['TEST_3SCALE_APP_KEYS']
- class ThreeScale::PersistenceTest < Test::Unit::TestCase
+ class ThreeScale::NetHttpPersistenceTest < MiniTest::Unit::TestCase
def setup
+ ThreeScale::Client::HTTPClient.persistent_backend = ThreeScale::Client::HTTPClient::NetHttpPersistent
+
provider_key = ENV['TEST_3SCALE_PROVIDER_KEY']
@app_id = ENV['TEST_3SCALE_APP_IDS']
@app_key = ENV['TEST_3SCALE_APP_KEYS']
- @client = ThreeScale::Client.new(:provider_key => provider_key, :persistence => true)
+ @client = ThreeScale::Client.new(provider_key: provider_key, persistence: true)
if defined?(FakeWeb)
FakeWeb.allow_net_connect = true
end
end
@@ -22,9 +26,17 @@
def test_keepalive_disconnect
assert @client.authorize(:app_id => @app_id, :app_key => @app_key).success?
sleep 70
assert @client.authorize(:app_id => @app_id, :app_key => @app_key).success?
+ end
+ end
+
+
+ class ThreeScale::NetHttpKeepaliveTest < ThreeScale::NetHttpPersistenceTest
+ def setup
+ ThreeScale::Client::HTTPClient.persistent_backend = ThreeScale::Client::HTTPClient::NetHttpKeepAlive
+ super
end
end
end