mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 13:15:40 +02:00
updated approach for loading schemas in xml console
This commit is contained in:
parent
ad23a7cbd2
commit
5b8b18f584
18 changed files with 258 additions and 55 deletions
|
@ -1,15 +1,22 @@
|
||||||
class Registrar
|
class Registrar
|
||||||
class XmlConsolesController < DeppController
|
class XmlConsolesController < DeppController
|
||||||
|
PREFS = %w[
|
||||||
|
domain-ee
|
||||||
|
contact-ee
|
||||||
|
eis
|
||||||
|
epp-ee
|
||||||
|
].freeze
|
||||||
|
|
||||||
authorize_resource class: false
|
authorize_resource class: false
|
||||||
|
|
||||||
def show
|
def show; end
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
begin
|
begin
|
||||||
@result = depp_current_user.server.request(params[:payload])
|
@result = depp_current_user.server.request(params[:payload])
|
||||||
checking_schema_valid_path(params[:payload])
|
|
||||||
rescue
|
check_schema_path(params[:payload])
|
||||||
|
rescue StandardError
|
||||||
@result = 'CONNECTION ERROR - Is the EPP server running?'
|
@result = 'CONNECTION ERROR - Is the EPP server running?'
|
||||||
end
|
end
|
||||||
render :show
|
render :show
|
||||||
|
@ -19,31 +26,78 @@ class Registrar
|
||||||
cl_trid = "#{depp_current_user.tag}-#{Time.zone.now.to_i}"
|
cl_trid = "#{depp_current_user.tag}-#{Time.zone.now.to_i}"
|
||||||
xml_dir_path = Rails.root + 'app/views/registrar/xml_consoles/epp_requests'
|
xml_dir_path = Rails.root + 'app/views/registrar/xml_consoles/epp_requests'
|
||||||
xml = File.read("#{xml_dir_path}/#{params[:obj]}/#{params[:epp_action]}.xml")
|
xml = File.read("#{xml_dir_path}/#{params[:obj]}/#{params[:epp_action]}.xml")
|
||||||
xml.gsub!('<clTRID>ABC-12345</clTRID>', "<clTRID>#{cl_trid}</clTRID>")
|
xml = prepare_payload(xml, cl_trid)
|
||||||
|
|
||||||
render plain: xml
|
render plain: xml
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
protected
|
||||||
|
|
||||||
def checking_schema_valid_path(payload)
|
def check_schema_path(payload)
|
||||||
path = regex_to_find_domain_schema(payload)
|
path = nil
|
||||||
|
path = regex_to_find_domain_schema(payload) if regex_to_find_domain_schema(payload).present?
|
||||||
|
path = regex_to_find_contact_schema(payload) if regex_to_find_contact_schema(payload).present?
|
||||||
|
path = regex_to_find_poll_schema(payload) if regex_to_find_poll_schema(payload).present?
|
||||||
|
|
||||||
@result = template_wrong_path unless array_valid_paths.include? path
|
@result = wrong_path_response unless array_valid_paths.include? path
|
||||||
end
|
end
|
||||||
|
|
||||||
def array_valid_paths
|
def array_valid_paths
|
||||||
Xsd::Schema::PREFIXES.map { |prefix| Xsd::Schema.filename(for_prefix: prefix) }
|
Xsd::Schema::PREFIXES.map { |prefix| Xsd::Schema.filename(for_prefix: prefix) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def template_wrong_path
|
def wrong_path_response
|
||||||
'Wrong schema path'
|
cl_trid = "#{depp_current_user.tag}-#{Time.zone.now.to_i}"
|
||||||
|
|
||||||
|
<<~XML
|
||||||
|
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||||
|
<epp xmlns=\"https://epp.tld.ee/schema/epp-ee-1.0.xsd\"
|
||||||
|
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
|
||||||
|
xsi:schemaLocation=\"lib/schemas/epp-ee-1.0.xsd\">
|
||||||
|
<response>
|
||||||
|
<result code=\"2100\">
|
||||||
|
<msg lang=\"en\">Wrong schema</msg>
|
||||||
|
</result>
|
||||||
|
<trID>
|
||||||
|
<clTRID>#{cl_trid}</clTRID>
|
||||||
|
<svTRID>eePrx-#{Time.zone.now.to_i}</svTRID>
|
||||||
|
</trID>
|
||||||
|
</response>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
end
|
end
|
||||||
|
|
||||||
def regex_to_find_domain_schema(payload)
|
def regex_to_find_domain_schema(payload)
|
||||||
domain_schema_tag = payload.scan(/xmlns:domain[\S]+/)
|
domain_schema_tag = payload.scan(/xmlns:domain\S+/)
|
||||||
schema_path = domain_schema_tag.to_s.match(/https?:\/\/[\S]+/)[0]
|
return if domain_schema_tag.empty?
|
||||||
path = schema_path.split('\\')[0]
|
|
||||||
path
|
schema_path = domain_schema_tag.to_s.match(%r{https?://\S+})[0]
|
||||||
|
schema_path.split('\\')[0]
|
||||||
|
end
|
||||||
|
|
||||||
|
def regex_to_find_contact_schema(payload)
|
||||||
|
contact_schema_tag = payload.scan(/xmlns:contact\S+/)
|
||||||
|
return if contact_schema_tag.empty?
|
||||||
|
|
||||||
|
schema_path = contact_schema_tag.to_s.match(%r{https?://\S+})[0]
|
||||||
|
schema_path.split('\\')[0]
|
||||||
|
end
|
||||||
|
|
||||||
|
def regex_to_find_poll_schema(payload)
|
||||||
|
contact_schema_tag = payload.scan(/poll\S+/)
|
||||||
|
return if contact_schema_tag.empty?
|
||||||
|
|
||||||
|
'https://epp.tld.ee/schema/epp-ee-1.0.xsd'
|
||||||
|
end
|
||||||
|
|
||||||
|
def prepare_payload(xml, cl_trid)
|
||||||
|
PREFS.map do |pref|
|
||||||
|
xml.gsub!('"' + pref.to_s + '"',
|
||||||
|
"\"#{Xsd::Schema.filename(for_prefix: pref.to_s)}\"")
|
||||||
|
end
|
||||||
|
|
||||||
|
xml.gsub!('<clTRID>ABC-12345</clTRID>', "<clTRID>#{cl_trid}</clTRID>")
|
||||||
|
xml
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<check>
|
<check>
|
||||||
<contact:check
|
<contact:check
|
||||||
xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
|
xmlns:contact="contact-ee">
|
||||||
<contact:id>sh8013</contact:id>
|
<contact:id>sh8013</contact:id>
|
||||||
</contact:check>
|
</contact:check>
|
||||||
</check>
|
</check>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<check>
|
<check>
|
||||||
<contact:check
|
<contact:check
|
||||||
xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
|
xmlns:contact="contact-ee">
|
||||||
<contact:id>sh8013</contact:id>
|
<contact:id>sh8013</contact:id>
|
||||||
<contact:id>sh13</contact:id>
|
<contact:id>sh13</contact:id>
|
||||||
<contact:id>vsdfvq</contact:id>
|
<contact:id>vsdfvq</contact:id>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<create>
|
<create>
|
||||||
<contact:create xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
|
<contact:create xmlns:contact="contact-ee">
|
||||||
<contact:postalInfo>
|
<contact:postalInfo>
|
||||||
<contact:name>Sillius Soddus</contact:name>
|
<contact:name>Sillius Soddus</contact:name>
|
||||||
<contact:addr>
|
<contact:addr>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
</contact:create>
|
</contact:create>
|
||||||
</create>
|
</create>
|
||||||
<extension>
|
<extension>
|
||||||
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
|
<eis:extdata xmlns:eis="eis">
|
||||||
<eis:ident type="org" cc="EE">123</eis:ident>
|
<eis:ident type="org" cc="EE">123</eis:ident>
|
||||||
<eis:legalDocument type="pdf">
|
<eis:legalDocument type="pdf">
|
||||||
dGVzdCBmYWlsCg==
|
dGVzdCBmYWlsCg==
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<delete>
|
<delete>
|
||||||
<contact:delete
|
<contact:delete
|
||||||
xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
|
xmlns:contact="contact-ee">
|
||||||
<contact:id>sh8013</contact:id>
|
<contact:id>sh8013</contact:id>
|
||||||
<contact:authInfo>
|
<contact:authInfo>
|
||||||
<contact:pw>wrong-one</contact:pw>
|
<contact:pw>wrong-one</contact:pw>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
</contact:delete>
|
</contact:delete>
|
||||||
</delete>
|
</delete>
|
||||||
<extension>
|
<extension>
|
||||||
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
|
<eis:extdata xmlns:eis="eis">
|
||||||
<eis:legalDocument type="pdf">
|
<eis:legalDocument type="pdf">
|
||||||
dGVzdCBmYWlsCg==
|
dGVzdCBmYWlsCg==
|
||||||
</eis:legalDocument>
|
</eis:legalDocument>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<info>
|
<info>
|
||||||
<contact:info xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
|
<contact:info xmlns:contact="contact-ee">
|
||||||
<contact:id>sh8013</contact:id>
|
<contact:id>sh8013</contact:id>
|
||||||
<contact:authInfo>
|
<contact:authInfo>
|
||||||
<contact:pw>Aas34fq</contact:pw>
|
<contact:pw>Aas34fq</contact:pw>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<update>
|
<update>
|
||||||
<contact:update xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
|
<contact:update xmlns:contact="contact-ee">
|
||||||
<contact:id>sh8013</contact:id>
|
<contact:id>sh8013</contact:id>
|
||||||
<contact:chg>
|
<contact:chg>
|
||||||
<contact:postalInfo>
|
<contact:postalInfo>
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
</contact:update>
|
</contact:update>
|
||||||
</update>
|
</update>
|
||||||
<extension>
|
<extension>
|
||||||
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
|
<eis:extdata xmlns:eis="eis">
|
||||||
<eis:legalDocument type="pdf">
|
<eis:legalDocument type="pdf">
|
||||||
dGVzdCBmYWlsCg==
|
dGVzdCBmYWlsCg==
|
||||||
</eis:legalDocument>
|
</eis:legalDocument>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<check>
|
<check>
|
||||||
<domain:check
|
<domain:check
|
||||||
xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd">
|
xmlns:domain="domain-ee">
|
||||||
<domain:name>example.ee</domain:name>
|
<domain:name>example.ee</domain:name>
|
||||||
</domain:check>
|
</domain:check>
|
||||||
</check>
|
</check>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<update>
|
<update>
|
||||||
<domain:update
|
<domain:update
|
||||||
xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd">
|
xmlns:domain="domain-ee">
|
||||||
<domain:name>example.ee</domain:name>
|
<domain:name>example.ee</domain:name>
|
||||||
<domain:rem>
|
<domain:rem>
|
||||||
<domain:status s="clientHold"/>
|
<domain:status s="clientHold"/>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<create>
|
<create>
|
||||||
<domain:create
|
<domain:create
|
||||||
xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd">
|
xmlns:domain="domain-ee">
|
||||||
<domain:name>example.ee</domain:name>
|
<domain:name>example.ee</domain:name>
|
||||||
<domain:period unit="y">1</domain:period>
|
<domain:period unit="y">1</domain:period>
|
||||||
<domain:ns>
|
<domain:ns>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<secDNS:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</secDNS:pubKey>
|
<secDNS:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</secDNS:pubKey>
|
||||||
</secDNS:keyData>
|
</secDNS:keyData>
|
||||||
</secDNS:create>
|
</secDNS:create>
|
||||||
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
|
<eis:extdata xmlns:eis="eis">
|
||||||
<eis:legalDocument type="pdf">
|
<eis:legalDocument type="pdf">
|
||||||
dGVzdCBmYWlsCg==
|
dGVzdCBmYWlsCg==
|
||||||
</eis:legalDocument>
|
</eis:legalDocument>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<delete>
|
<delete>
|
||||||
<domain:delete
|
<domain:delete
|
||||||
xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd">
|
xmlns:domain="domain-ee">
|
||||||
<domain:name>example.ee</domain:name>
|
<domain:name>example.ee</domain:name>
|
||||||
</domain:delete>
|
</domain:delete>
|
||||||
</delete>
|
</delete>
|
||||||
<extension>
|
<extension>
|
||||||
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'ee')}">
|
<eis:extdata xmlns:eis="eis">
|
||||||
<eis:legalDocument type="pdf">
|
<eis:legalDocument type="pdf">
|
||||||
dGVzdCBmYWlsCg==
|
dGVzdCBmYWlsCg==
|
||||||
</eis:legalDocument>
|
</eis:legalDocument>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<info>
|
<info>
|
||||||
<domain:info
|
<domain:info
|
||||||
xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd">
|
xmlns:domain="domain-ee">
|
||||||
<domain:name hosts="all">example.ee</domain:name>
|
<domain:name hosts="all">example.ee</domain:name>
|
||||||
<domain:authInfo>
|
<domain:authInfo>
|
||||||
<domain:pw>2fooBAR</domain:pw>
|
<domain:pw>2fooBAR</domain:pw>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<renew>
|
<renew>
|
||||||
<domain:renew
|
<domain:renew
|
||||||
xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd">
|
xmlns:domain="domain-ee">
|
||||||
<domain:name>example.ee</domain:name>
|
<domain:name>example.ee</domain:name>
|
||||||
<domain:curExpDate>2014-08-07</domain:curExpDate>
|
<domain:curExpDate>2014-08-07</domain:curExpDate>
|
||||||
<domain:period unit="y">1</domain:period>
|
<domain:period unit="y">1</domain:period>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<transfer op="request">
|
<transfer op="request">
|
||||||
<domain:transfer
|
<domain:transfer
|
||||||
xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd">
|
xmlns:domain="domain-ee">
|
||||||
<domain:name>example.ee</domain:name>
|
<domain:name>example.ee</domain:name>
|
||||||
<domain:authInfo>
|
<domain:authInfo>
|
||||||
<domain:pw roid="JD1234-REP">2BARfoo</domain:pw>
|
<domain:pw roid="JD1234-REP">2BARfoo</domain:pw>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
</domain:transfer>
|
</domain:transfer>
|
||||||
</transfer>
|
</transfer>
|
||||||
<extension>
|
<extension>
|
||||||
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'ee')}">
|
<eis:extdata xmlns:eis="eis">
|
||||||
<eis:legalDocument type="pdf">
|
<eis:legalDocument type="pdf">
|
||||||
dGVzdCBmYWlsCg==
|
dGVzdCBmYWlsCg==
|
||||||
</eis:legalDocument>
|
</eis:legalDocument>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="epp-ee">
|
||||||
<command>
|
<command>
|
||||||
<update>
|
<update>
|
||||||
<domain:update
|
<domain:update
|
||||||
xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd">
|
xmlns:domain="domain-ee">
|
||||||
<domain:name>example.ee</domain:name>
|
<domain:name>example.ee</domain:name>
|
||||||
<domain:add>
|
<domain:add>
|
||||||
<domain:ns>
|
<domain:ns>
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
</secDNS:keyData>
|
</secDNS:keyData>
|
||||||
</secDNS:rem>
|
</secDNS:rem>
|
||||||
</secDNS:update>
|
</secDNS:update>
|
||||||
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
|
<eis:extdata xmlns:eis="eis">
|
||||||
<eis:legalDocument type="pdf">
|
<eis:legalDocument type="pdf">
|
||||||
dGVzdCBmYWlsCg==
|
dGVzdCBmYWlsCg==
|
||||||
</eis:legalDocument>
|
</eis:legalDocument>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
<command>
|
<command>
|
||||||
<poll op="req"/>
|
<poll op="req"/>
|
||||||
<clTRID>ABC-12345</clTRID>
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
|
112
test/integration/registrar_area/xml_consoles_test.rb
Normal file
112
test/integration/registrar_area/xml_consoles_test.rb
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class RegistrarXmlConsolesIntegrationTest < ApplicationIntegrationTest
|
||||||
|
setup do
|
||||||
|
sign_in users(:api_bestnames)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_check_schema_path
|
||||||
|
post registrar_xml_console_path, params: { payload: payload, frame: payload },
|
||||||
|
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||||
|
|
||||||
|
assert_response :ok
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_load_schema_path
|
||||||
|
get load_xml_registrar_xml_console_path, params: { obj: 'domain', epp_action: 'update' }
|
||||||
|
|
||||||
|
assert_response :ok
|
||||||
|
assert_equal update_payload, response.body
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def payload
|
||||||
|
<<~XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
<command>
|
||||||
|
<check>
|
||||||
|
<domain:check xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd">
|
||||||
|
<domain:name>auction.test</domain:name>
|
||||||
|
</domain:check>
|
||||||
|
</check>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
end
|
||||||
|
|
||||||
|
def wrong_payload
|
||||||
|
<<~XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
<command>
|
||||||
|
<check>
|
||||||
|
<domain:check xmlns:domain="https://eppdsfsdfsdf.tld.ee/schema/domain-ee-1.1.xsd">
|
||||||
|
<domain:name>auction.test</domain:name>
|
||||||
|
</domain:check>
|
||||||
|
</check>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_payload
|
||||||
|
<<~XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update
|
||||||
|
xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd">
|
||||||
|
<domain:name>example.ee</domain:name>
|
||||||
|
<domain:add>
|
||||||
|
<domain:ns>
|
||||||
|
<domain:hostAttr>
|
||||||
|
<domain:hostName>ns1.example.com</domain:hostName>
|
||||||
|
</domain:hostAttr>
|
||||||
|
<domain:hostAttr>
|
||||||
|
<domain:hostName>ns2.example.com</domain:hostName>
|
||||||
|
</domain:hostAttr>
|
||||||
|
</domain:ns>
|
||||||
|
<domain:contact type="tech">mak21</domain:contact>
|
||||||
|
</domain:add>
|
||||||
|
<domain:rem>
|
||||||
|
<domain:ns>
|
||||||
|
<domain:hostAttr>
|
||||||
|
<domain:hostName>ns1.example.net</domain:hostName>
|
||||||
|
</domain:hostAttr>
|
||||||
|
</domain:ns>
|
||||||
|
<domain:contact type="tech">mak21</domain:contact>
|
||||||
|
</domain:rem>
|
||||||
|
<domain:chg>
|
||||||
|
<domain:registrant>mak21</domain:registrant>
|
||||||
|
<domain:authInfo>
|
||||||
|
<domain:pw>newpw</domain:pw>
|
||||||
|
</domain:authInfo>
|
||||||
|
</domain:chg>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<extension>
|
||||||
|
<secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
|
||||||
|
<secDNS:rem>
|
||||||
|
<secDNS:keyData>
|
||||||
|
<secDNS:flags>257</secDNS:flags>
|
||||||
|
<secDNS:protocol>3</secDNS:protocol>
|
||||||
|
<secDNS:alg>8</secDNS:alg>
|
||||||
|
<secDNS:pubKey>700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f</secDNS:pubKey>
|
||||||
|
</secDNS:keyData>
|
||||||
|
</secDNS:rem>
|
||||||
|
</secDNS:update>
|
||||||
|
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||||
|
<eis:legalDocument type="pdf">
|
||||||
|
dGVzdCBmYWlsCg==
|
||||||
|
</eis:legalDocument>
|
||||||
|
</eis:extdata>
|
||||||
|
</extension>
|
||||||
|
<clTRID>test_bestnames-#{Time.zone.now.to_i}</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
end
|
||||||
|
end
|
37
test/system/registrar_area/xml_consoles_test.rb
Normal file
37
test/system/registrar_area/xml_consoles_test.rb
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
require 'application_system_test_case'
|
||||||
|
|
||||||
|
class RegistrarAreaXmlConsolesTest < ApplicationSystemTestCase
|
||||||
|
|
||||||
|
setup do
|
||||||
|
sign_in users(:api_bestnames)
|
||||||
|
end
|
||||||
|
|
||||||
|
# CodeRay
|
||||||
|
|
||||||
|
def test_epp_server_does_not_response
|
||||||
|
visit registrar_xml_console_path
|
||||||
|
fill_in 'payload', with: schema_example
|
||||||
|
click_on 'Send EPP Request'
|
||||||
|
|
||||||
|
el = page.find('.CodeRay', visible: :all)
|
||||||
|
assert el.text.include? 'CONNECTION ERROR - Is the EPP server running?'
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def schema_example
|
||||||
|
request_xml = <<~XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
|
||||||
|
<command>
|
||||||
|
<check>
|
||||||
|
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
|
||||||
|
<domain:name>auction.test</domain:name>
|
||||||
|
</domain:check>
|
||||||
|
</check>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue