fixed tests

This commit is contained in:
olegphenomenon 2022-11-07 15:59:48 +02:00
parent 045b5f03ba
commit 48c14b8a39
4 changed files with 6 additions and 3 deletions

View file

@ -34,7 +34,7 @@ module Epp
code: '2502',
msg: Shunter.default_error_message)
handle_errors
log_exception(exception)
log_exception(exception) unless Rails.env.test?
end
def respond_with_command_failed_error(exception)

View file

@ -29,7 +29,7 @@ module Repp
render(json: @response, status: :unauthorized)
rescue Shunter::ThrottleError => e
@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)
ensure
create_repp_log

View file

@ -26,7 +26,7 @@ module Shunter
logger.info "Request from #{throttled_user.class}/#{throttled_user.id} is coming through throttling"
yield if block_given?
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
end
end

View file

@ -58,6 +58,8 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
end
def test_returns_default_descriptions
ENV["shunter_default_threshold"] = '100'
descriptions = {
1000 => 'Command completed successfully',
1001 => 'Command completed successfully; action pending',
@ -88,6 +90,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
2502 => Shunter.default_error_message
}
assert_equal descriptions, Epp::Response::Result::Code.default_descriptions
ENV["shunter_default_threshold"] = '10000'
end
def test_equality