mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 21:16:12 +02:00
fixed tests
This commit is contained in:
parent
045b5f03ba
commit
48c14b8a39
4 changed files with 6 additions and 3 deletions
|
@ -34,7 +34,7 @@ module Epp
|
||||||
code: '2502',
|
code: '2502',
|
||||||
msg: Shunter.default_error_message)
|
msg: Shunter.default_error_message)
|
||||||
handle_errors
|
handle_errors
|
||||||
log_exception(exception)
|
log_exception(exception) unless Rails.env.test?
|
||||||
end
|
end
|
||||||
|
|
||||||
def respond_with_command_failed_error(exception)
|
def respond_with_command_failed_error(exception)
|
||||||
|
|
|
@ -29,7 +29,7 @@ module Repp
|
||||||
render(json: @response, status: :unauthorized)
|
render(json: @response, status: :unauthorized)
|
||||||
rescue Shunter::ThrottleError => e
|
rescue Shunter::ThrottleError => e
|
||||||
@response = { code: 2502, message: Shunter.default_error_message }
|
@response = { code: 2502, message: Shunter.default_error_message }
|
||||||
logger.error e.to_s
|
logger.error e.to_s unless Rails.env.test?
|
||||||
render(json: @response, status: :bad_request)
|
render(json: @response, status: :bad_request)
|
||||||
ensure
|
ensure
|
||||||
create_repp_log
|
create_repp_log
|
||||||
|
|
|
@ -26,7 +26,7 @@ module Shunter
|
||||||
logger.info "Request from #{throttled_user.class}/#{throttled_user.id} is coming through throttling"
|
logger.info "Request from #{throttled_user.class}/#{throttled_user.id} is coming through throttling"
|
||||||
yield if block_given?
|
yield if block_given?
|
||||||
else
|
else
|
||||||
logger.info "Too many requests from #{throttled_user.class}/#{throttled_user.id}."
|
logger.info "Too many requests from #{throttled_user.class}/#{throttled_user.id}." unless Rails.env.test?
|
||||||
raise Shunter::ThrottleError
|
raise Shunter::ThrottleError
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -58,6 +58,8 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_returns_default_descriptions
|
def test_returns_default_descriptions
|
||||||
|
ENV["shunter_default_threshold"] = '100'
|
||||||
|
|
||||||
descriptions = {
|
descriptions = {
|
||||||
1000 => 'Command completed successfully',
|
1000 => 'Command completed successfully',
|
||||||
1001 => 'Command completed successfully; action pending',
|
1001 => 'Command completed successfully; action pending',
|
||||||
|
@ -88,6 +90,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
|
||||||
2502 => Shunter.default_error_message
|
2502 => Shunter.default_error_message
|
||||||
}
|
}
|
||||||
assert_equal descriptions, Epp::Response::Result::Code.default_descriptions
|
assert_equal descriptions, Epp::Response::Result::Code.default_descriptions
|
||||||
|
ENV["shunter_default_threshold"] = '10000'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_equality
|
def test_equality
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue