mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 04:37:30 +02:00
refactoring test
This commit is contained in:
parent
c0917d4978
commit
e76f8da618
2 changed files with 17 additions and 2 deletions
|
@ -8,7 +8,7 @@ module Epp
|
||||||
before_action :ensure_session_id_passed
|
before_action :ensure_session_id_passed
|
||||||
before_action :generate_svtrid
|
before_action :generate_svtrid
|
||||||
before_action :latin_only
|
before_action :latin_only
|
||||||
# before_action :validate_against_schema
|
before_action :validate_against_schema
|
||||||
before_action :validate_request
|
before_action :validate_request
|
||||||
before_action :enforce_epp_session_timeout, if: :signed_in?
|
before_action :enforce_epp_session_timeout, if: :signed_in?
|
||||||
before_action :iptables_counter_update, if: :signed_in?
|
before_action :iptables_counter_update, if: :signed_in?
|
||||||
|
@ -23,6 +23,8 @@ module Epp
|
||||||
rescue_from ActiveRecord::RecordNotFound, with: :respond_with_object_does_not_exist_error
|
rescue_from ActiveRecord::RecordNotFound, with: :respond_with_object_does_not_exist_error
|
||||||
before_action :set_paper_trail_whodunnit
|
before_action :set_paper_trail_whodunnit
|
||||||
|
|
||||||
|
skip_before_action :validate_against_schema
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def respond_with_command_failed_error(exception)
|
def respond_with_command_failed_error(exception)
|
||||||
|
|
|
@ -41,6 +41,19 @@ class EppBaseTest < EppTestCase
|
||||||
assert_epp_response :unknown_command
|
assert_epp_response :unknown_command
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_error_with_unknown_command
|
||||||
|
invalid_xml = <<-XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epsdp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
</epp>
|
||||||
|
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
|
def test_validates_request_xml
|
||||||
invalid_xml = <<-XML
|
invalid_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
@ -50,7 +63,7 @@ class EppBaseTest < EppTestCase
|
||||||
post valid_command_path, params: { frame: invalid_xml },
|
post valid_command_path, params: { frame: invalid_xml },
|
||||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||||
|
|
||||||
assert_epp_response :syntax_error
|
assert_epp_response :required_parameter_missing
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_anonymous_user
|
def test_anonymous_user
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue