Sha256: 4b0a6f63455ab369d4585d416b84ab1e6143de53e768c70e3c0d82ecb46c5e45

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

require 'minitest/autorun'

require '3scale/client'
require 'mocha/setup'

if ENV['TEST_3SCALE_PROVIDER_KEY'] && ENV['TEST_3SCALE_APP_IDS'] && ENV['TEST_3SCALE_APP_KEYS']
  class ThreeScale::NetHttpPersistenceTest < MiniTest::Test
    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)

      if defined?(FakeWeb)
        FakeWeb.allow_net_connect = true
      end
    end

    def test_authorize
      assert @client.authorize(:app_id => @app_id, :app_key => @app_key).success?
    end

    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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
3scale_client-2.10.0 test/persistence_test.rb
3scale_client-2.9.0 test/persistence_test.rb
3scale_client-2.8.2 test/persistence_test.rb
3scale_client-2.8.1 test/persistence_test.rb
3scale_client-2.8.0 test/persistence_test.rb
3scale_client-2.7.0 test/persistence_test.rb
3scale_client-2.6.1 test/persistence_test.rb
3scale_client-2.6.0 test/persistence_test.rb