test/remote_test.rb in 3scale_client-2.10.0 vs test/remote_test.rb in 3scale_client-2.11.0
- old
+ new
@@ -3,19 +3,22 @@
if ENV['TEST_3SCALE_PROVIDER_KEY'] &&
ENV['TEST_3SCALE_APP_IDS'] &&
ENV['TEST_3SCALE_APP_KEYS']
class ThreeScale::RemoteTest < MiniTest::Test
+ WARN_DEPRECATED = ENV['WARN_DEPRECATED'] == '1'
+
def setup
@provider_key = ENV['TEST_3SCALE_PROVIDER_KEY']
stripper = lambda { |string| string.strip }
@app_ids = ENV['TEST_3SCALE_APP_IDS'].split(',').map(&stripper)
@app_keys = ENV['TEST_3SCALE_APP_KEYS'].split(',').map(&stripper)
- @client = ThreeScale::Client.new(:provider_key => @provider_key)
+ @client = ThreeScale::Client.new(provider_key: @provider_key,
+ warn_deprecated: WARN_DEPRECATED)
if defined?(FakeWeb)
FakeWeb.clean_registry
FakeWeb.allow_net_connect = true
end
@@ -37,11 +40,13 @@
assert response.success?, "AuthRep should succeed for app_id=#{@app_ids[0]} and app_key=#{app_key}, but it failed with: '#{response.error_message}'"
end
end
def test_successful_secure_authrep
- @client = ThreeScale::Client.new(:provider_key => @provider_key, :secure => true)
+ @client = ThreeScale::Client.new(provider_key: @provider_key,
+ warn_deprecated: WARN_DEPRECATED,
+ secure: true)
test_successful_authrep
end
def test_failed_authrep
@@ -94,10 +99,11 @@
def test_failed_report
transactions = @app_ids.map do |app_id|
{:app_id => app_id, :usage => {'hits' => 1}}
end
- client = ThreeScale::Client.new(:provider_key => 'invalid-key')
+ client = ThreeScale::Client.new(provider_key: 'invalid-key',
+ warn_deprecated: WARN_DEPRECATED)
response = client.report(transactions: transactions)
assert !response.success?
assert_equal 'provider_key_invalid', response.error_code
assert_equal 'provider key "invalid-key" is invalid', response.error_message
end