From e76f8da61819eaf066651a4735eed9b80c1794ba Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Tue, 27 Apr 2021 15:25:56 +0300 Subject: [PATCH] refactoring test --- app/controllers/epp/base_controller.rb | 4 +++- test/integration/epp/base_test.rb | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/controllers/epp/base_controller.rb b/app/controllers/epp/base_controller.rb index 3943d741b0..820fe90980 100644 --- a/app/controllers/epp/base_controller.rb +++ b/app/controllers/epp/base_controller.rb @@ -8,7 +8,7 @@ class AuthorizationError < StandardError; end before_action :ensure_session_id_passed before_action :generate_svtrid before_action :latin_only - # before_action :validate_against_schema + before_action :validate_against_schema before_action :validate_request before_action :enforce_epp_session_timeout, if: :signed_in? before_action :iptables_counter_update, if: :signed_in? @@ -23,6 +23,8 @@ class AuthorizationError < StandardError; end rescue_from ActiveRecord::RecordNotFound, with: :respond_with_object_does_not_exist_error before_action :set_paper_trail_whodunnit + skip_before_action :validate_against_schema + protected def respond_with_command_failed_error(exception) diff --git a/test/integration/epp/base_test.rb b/test/integration/epp/base_test.rb index 3e40ac5254..41fb186fed 100644 --- a/test/integration/epp/base_test.rb +++ b/test/integration/epp/base_test.rb @@ -41,6 +41,19 @@ def test_additional_error assert_epp_response :unknown_command end + def test_error_with_unknown_command + invalid_xml = <<-XML + + + + XML + + get '/epp/error', params: { frame: invalid_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } + + assert_epp_response :unknown_command + end + def test_validates_request_xml invalid_xml = <<-XML @@ -50,7 +63,7 @@ def test_validates_request_xml post valid_command_path, params: { frame: invalid_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } - assert_epp_response :syntax_error + assert_epp_response :required_parameter_missing end def test_anonymous_user