Change EPP response code according to its specification

Fixes #587
This commit is contained in:
Artur Beljajev 2019-09-13 21:06:23 +03:00 committed by Alex Sherman
parent 744d6a2b53
commit daeb00ebe7
4 changed files with 7 additions and 3 deletions

View file

@ -79,8 +79,8 @@ module Epp
if success && EppSession.limit_reached?(@api_user.registrar) if success && EppSession.limit_reached?(@api_user.registrar)
epp_errors << { epp_errors << {
msg: 'Authentication error; server closing connection (connection limit reached)', msg: 'Session limit exceeded; server closing connection (connection limit reached)',
code: '2501' code: '2502',
} }
success = false success = false

View file

@ -30,6 +30,7 @@ module Epp
data_management_policy_violation: 2308, data_management_policy_violation: 2308,
command_failed: 2400, command_failed: 2400,
authentication_error_server_closing_connection: 2501, authentication_error_server_closing_connection: 2501,
session_limit_exceeded_server_closing_connection: 2502,
}.freeze }.freeze
private_constant :KEY_TO_VALUE private_constant :KEY_TO_VALUE
@ -59,6 +60,7 @@ module Epp
2308 => 'Data management policy violation', 2308 => 'Data management policy violation',
2400 => 'Command failed', 2400 => 'Command failed',
2501 => 'Authentication error; server closing connection', 2501 => 'Authentication error; server closing connection',
2502 => 'Session limit exceeded; server closing connection',
}.freeze }.freeze
private_constant :DEFAULT_DESCRIPTIONS private_constant :DEFAULT_DESCRIPTIONS

View file

@ -169,6 +169,6 @@ class EppLoginTest < EppTestCase
assert_no_difference 'EppSession.count' do assert_no_difference 'EppSession.count' do
post '/epp/session/login', { frame: request_xml }, 'HTTP_COOKIE' => 'session=new-session-id' post '/epp/session/login', { frame: request_xml }, 'HTTP_COOKIE' => 'session=new-session-id'
end end
assert_epp_response :authentication_error_server_closing_connection assert_epp_response :session_limit_exceeded_server_closing_connection
end end
end end

View file

@ -51,6 +51,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
data_management_policy_violation: 2308, data_management_policy_violation: 2308,
command_failed: 2400, command_failed: 2400,
authentication_error_server_closing_connection: 2501, authentication_error_server_closing_connection: 2501,
session_limit_exceeded_server_closing_connection: 2502,
} }
assert_equal codes, Epp::Response::Result::Code.codes assert_equal codes, Epp::Response::Result::Code.codes
end end
@ -82,6 +83,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
2308 => 'Data management policy violation', 2308 => 'Data management policy violation',
2400 => 'Command failed', 2400 => 'Command failed',
2501 => 'Authentication error; server closing connection', 2501 => 'Authentication error; server closing connection',
2502 => 'Session limit exceeded; server closing connection',
} }
assert_equal descriptions, Epp::Response::Result::Code.default_descriptions assert_equal descriptions, Epp::Response::Result::Code.default_descriptions
end end