test/client_test.rb in 3scale_client-2.3.3 vs test/client_test.rb in 3scale_client-2.3.4
- old
+ new
@@ -53,10 +53,16 @@
assert_authrep_url_with_params "&app_id=appid&app_key=appkey&%5Busage%5D%5Bhits%5D=1"
@client.authrep(:app_id => "appid", :app_key => "appkey")
end
+ def test_authrep_supports_service_id
+ assert_authrep_url_with_params "&%5Busage%5D%5Bhits%5D=1&service_id=serviceid"
+
+ @client.authrep(:service_id => "serviceid")
+ end
+
#TODO these authrep tests
def test_authrep_supports_api_key_auth_mode; end
def test_authrep_log_is_encoded;end
def test_authrep_passes_all_params_to_backend;end
@@ -110,9 +116,21 @@
</status>'
FakeWeb.register_uri(:get, "http://#{@host}/transactions/authorize.xml?provider_key=1234abcd&app_id=foo&app_key=toosecret", :status => ['200', 'OK'], :body => body)
response = @client.authorize(:app_id => 'foo', :app_key => 'toosecret')
+ assert response.success?
+ end
+
+ def test_successful_authorize_with_user_key
+ body = '<status>
+ <authorized>true</authorized>
+ <plan>Ultimate</plan>
+ </status>'
+
+ FakeWeb.register_uri(:get, "http://#{@host}/transactions/authorize.xml?provider_key=1234abcd&user_key=foo", :status => ['200', 'OK'], :body => body)
+
+ response = @client.authorize(:user_key => 'foo')
assert response.success?
end
def test_authorize_with_exceeded_usage_limits
body = '<status>