Merge pull request #2032 from internetee/2030-support-multiple-schema-file-versions

2030 support multiple schema file versions
This commit is contained in:
Timo Võhmar 2021-06-16 12:53:43 +03:00 committed by GitHub
commit f096f465d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 1194 additions and 278 deletions

View file

@ -62,7 +62,7 @@ gem 'omniauth-tara', github: 'internetee/omniauth-tara'
gem 'epp', github: 'internetee/epp', branch: :master
gem 'epp-xml', '1.1.0', github: 'internetee/epp-xml'
gem 'epp-xml', '1.2.0', github: 'internetee/epp-xml', branch: :master
gem 'que'
gem 'daemons-rails', '1.2.1'
gem 'que-web'

View file

@ -28,9 +28,10 @@ GIT
GIT
remote: https://github.com/internetee/epp-xml.git
revision: 27959f8cb244ea5eabaeeee747984988b454e840
revision: cab8ba4d07b16e664b8ae6d3c6a6821e89a48b78
branch: master
specs:
epp-xml (1.1.0)
epp-xml (1.2.0)
activesupport (>= 4.1)
builder (~> 3.2)
@ -532,7 +533,7 @@ DEPENDENCIES
domain_name
e_invoice!
epp!
epp-xml (= 1.1.0)!
epp-xml (= 1.2.0)!
figaro (~> 1.2)
haml (~> 5.0)
isikukood
@ -575,4 +576,4 @@ DEPENDENCIES
wkhtmltopdf-binary (~> 0.12.5.1)
BUNDLED WITH
2.2.17
2.2.20

View file

@ -127,6 +127,7 @@ module Epp
# VALIDATION
def validate_request
validation_method = "validate_#{params[:action]}"
return unless respond_to?(validation_method, true)
send(validation_method)

View file

@ -11,5 +11,10 @@ module Epp
epp_errors.add(:epp_errors, code: '2000', msg: 'Unknown command')
render_epp_response '/epp/error'
end
def wrong_schema
epp_errors.add(:epp_errors, code: '2100', msg: 'Wrong path')
render_epp_response '/epp/error'
end
end
end

View file

@ -1,14 +1,20 @@
class Registrar
class XmlConsolesController < DeppController
PREFS = %w[
domain-ee
contact-ee
eis
epp-ee
].freeze
authorize_resource class: false
def show
end
def show; end
def create
begin
@result = depp_current_user.server.request(params[:payload])
rescue
rescue StandardError
@result = 'CONNECTION ERROR - Is the EPP server running?'
end
render :show
@ -18,8 +24,21 @@ class Registrar
cl_trid = "#{depp_current_user.tag}-#{Time.zone.now.to_i}"
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.gsub!('<clTRID>ABC-12345</clTRID>', "<clTRID>#{cl_trid}</clTRID>")
xml = prepare_payload(xml, cl_trid)
render plain: xml
end
protected
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

View file

@ -6,13 +6,13 @@ module Depp
attr_accessor :name, :current_user, :epp_xml
STATUSES = %w(
STATUSES = %w[
clientDeleteProhibited
clientHold
clientRenewProhibited
clientTransferProhibited
clientUpdateProhibited
)
].freeze
PERIODS = [
['3 months', '3m'],
@ -28,11 +28,15 @@ module Depp
['8 years', '8y'],
['9 years', '9y'],
['10 years', '10y'],
]
].freeze
def initialize(args = {})
self.current_user = args[:current_user]
self.epp_xml = EppXml::Domain.new(cl_trid_prefix: current_user.tag)
self.epp_xml = EppXml::Domain.new(
cl_trid_prefix: current_user.tag,
schema_prefix: 'domain-ee',
schema_version: '1.1'
)
end
def info(domain_name)
@ -49,6 +53,11 @@ module Depp
current_user.request(xml)
end
def hostname_present
domain_params[:nameservers_attributes]
.select { |_key, value| value['hostname'].present? }.any?
end
def create(domain_params)
dns_hash = {}
keys = Domain.create_dnskeys_hash(domain_params)
@ -57,22 +66,22 @@ module Depp
period = domain_params[:period].to_i.to_s
period_unit = domain_params[:period][-1].to_s
if domain_params[:nameservers_attributes].select { |key, value| value['hostname'].present? }.any?
xml = epp_xml.create({
name: { value: domain_params[:name] },
period: { value: period, attrs: { unit: period_unit } },
ns: Domain.create_nameservers_hash(domain_params),
registrant: { value: domain_params[:registrant] },
_anonymus: Domain.create_contacts_hash(domain_params)
}, dns_hash, Domain.construct_custom_params_hash(domain_params))
else
xml = epp_xml.create({
name: { value: domain_params[:name] },
period: { value: period, attrs: { unit: period_unit } },
registrant: { value: domain_params[:registrant] },
_anonymus: Domain.create_contacts_hash(domain_params)
}, dns_hash, Domain.construct_custom_params_hash(domain_params))
end
xml = if hostname_present
epp_xml.create({
name: { value: domain_params[:name] },
period: { value: period, attrs: { unit: period_unit } },
ns: Domain.create_nameservers_hash(domain_params),
registrant: { value: domain_params[:registrant] },
_anonymus: Domain.create_contacts_hash(domain_params)
}, dns_hash, Domain.construct_custom_params_hash(domain_params))
else
epp_xml.create({
name: { value: domain_params[:name] },
period: { value: period, attrs: { unit: period_unit } },
registrant: { value: domain_params[:registrant] },
_anonymus: Domain.create_contacts_hash(domain_params)
}, dns_hash, Domain.construct_custom_params_hash(domain_params))
end
current_user.request(xml)
end
@ -92,9 +101,10 @@ module Depp
def delete(domain_params)
xml = epp_xml.delete({
name: { value: domain_params[:name] }},
Depp::Domain.construct_custom_params_hash(domain_params),
(domain_params[:verified].present? && 'yes'))
name: { value: domain_params[:name] },
},
Depp::Domain.construct_custom_params_hash(domain_params),
(domain_params[:verified].present? && 'yes'))
current_user.request(xml)
end
@ -104,10 +114,10 @@ module Depp
period_unit = params[:period][-1].to_s
current_user.request(epp_xml.renew(
name: { value: params[:domain_name] },
curExpDate: { value: params[:cur_exp_date] },
period: { value: period, attrs: { unit: period_unit } }
))
name: { value: params[:domain_name] },
curExpDate: { value: params[:cur_exp_date] },
period: { value: period, attrs: { unit: period_unit } }
))
end
def transfer(params)
@ -117,9 +127,9 @@ module Depp
op = params[:reject] ? 'reject' : op
current_user.request(epp_xml.transfer({
name: { value: params[:domain_name] },
authInfo: { pw: { value: params[:transfer_code] } }
}, op, Domain.construct_custom_params_hash(params)))
name: { value: params[:domain_name] },
authInfo: { pw: { value: params[:transfer_code] } }
}, op, Domain.construct_custom_params_hash(params)))
end
def confirm_transfer(domain_params)
@ -127,9 +137,9 @@ module Depp
pw = data.css('pw').text
xml = epp_xml.transfer({
name: { value: domain_params[:name] },
authInfo: { pw: { value: pw } }
}, 'approve')
name: { value: domain_params[:name] },
authInfo: { pw: { value: pw } }
}, 'approve')
current_user.request(xml)
end
@ -171,24 +181,25 @@ module Depp
hostname: x.css('hostName').text,
ipv4: Array(x.css('hostAddr[ip="v4"]')).map(&:text).join(','),
ipv6: Array(x.css('hostAddr[ip="v6"]')).map(&:text).join(',')
}
}
end
data.css('keyData').each_with_index do |x, i|
ret[:dnskeys_attributes][i] = {
flags: x.css('flags').text,
protocol: x.css('protocol').text,
alg: x.css('alg').text,
public_key: x.css('pubKey').text,
ds_key_tag: x.css('keyTag').first.try(:text),
ds_alg: x.css('alg').first.try(:text),
ds_digest_type: x.css('digestType').first.try(:text),
ds_digest: x.css('digest').first.try(:text)
flags: x.css('flags').text,
protocol: x.css('protocol').text,
alg: x.css('alg').text,
public_key: x.css('pubKey').text,
ds_key_tag: x.css('keyTag').first.try(:text),
ds_alg: x.css('alg').first.try(:text),
ds_digest_type: x.css('digestType').first.try(:text),
ds_digest: x.css('digest').first.try(:text)
}
end
data.css('status').each_with_index do |x, i|
next unless STATUSES.include?(x['s'])
ret[:statuses_attributes][i] = {
code: x['s'],
description: x.text
@ -203,7 +214,7 @@ module Depp
if domain_params[:legal_document].present?
type = domain_params[:legal_document].original_filename.split('.').last.downcase
custom_params[:_anonymus] << {
legalDocument: { value: Base64.encode64(domain_params[:legal_document].read), attrs: { type: type } }
legalDocument: { value: Base64.encode64(domain_params[:legal_document].read), attrs: { type: type } }
}
end
@ -231,9 +242,12 @@ module Depp
rem_arr << { ns: rem_ns } if rem_ns.any?
rem_arr << { _anonymus: rem_anon } if rem_anon.any?
if domain_params[:registrant] != old_domain_params[:registrant]
chg = [{ registrant: { value: domain_params[:registrant] } }] if !domain_params[:verified].present?
chg = [{ registrant: { value: domain_params[:registrant], attrs: { verified: 'yes' } } }] if domain_params[:verified]
return if domain_params[:registrant] == old_domain_params[:registrant]
chg = [{ registrant: { value: domain_params[:registrant] } }]
if domain_params[:verified].blank? && (domain_params[:verified])
chg = [{ registrant: { value: domain_params[:registrant],
attrs: { verified: 'yes' } } }]
end
add_arr = nil if add_arr.none?
@ -263,13 +277,17 @@ module Depp
host_attr = []
host_attr << { hostName: { value: v['hostname'] } }
v['ipv4'].to_s.split(",").each do |ip|
host_attr << { hostAddr: { value: ip, attrs: { ip: 'v4' } } }
end if v['ipv4'].present?
if v['ipv4'].present?
v['ipv4'].to_s.split(',').each do |ip|
host_attr << { hostAddr: { value: ip, attrs: { ip: 'v4' } } }
end
end
v['ipv6'].to_s.split(",").each do |ip|
host_attr << { hostAddr: { value: ip, attrs: { ip: 'v6' } } }
end if v['ipv6'].present?
if v['ipv6'].present?
v['ipv6'].to_s.split(',').each do |ip|
host_attr << { hostAddr: { value: ip, attrs: { ip: 'v6' } } }
end
end
ret << { hostAttr: host_attr }
end
@ -281,6 +299,7 @@ module Depp
ret = []
domain_params[:contacts_attributes].each do |_k, v|
next if v['code'].blank?
ret << {
contact: { value: v['code'], attrs: { type: v['type'] } }
}
@ -294,9 +313,11 @@ module Depp
domain_params[:dnskeys_attributes].each do |_k, v|
if v['ds_key_tag'].blank?
kd = create_key_data_hash(v)
ret << {
keyData: kd
} if kd
if kd
ret << {
keyData: kd
}
end
else
ret << {
dsData: [
@ -315,6 +336,7 @@ module Depp
def create_key_data_hash(key_data_params)
return nil if key_data_params['public_key'].blank?
{
flags: { value: key_data_params['flags'] },
protocol: { value: key_data_params['protocol'] },
@ -331,6 +353,6 @@ module Depp
end
ret
end
end
end
end
end

View file

@ -17,6 +17,7 @@ module Epp
required_parameter_missing: 2003,
parameter_value_range_error: 2004,
parameter_value_syntax_error: 2005,
wrong_schema: 2100,
unimplemented: 2101,
billing_failure: 2104,
object_is_not_eligible_for_renewal: 2105,
@ -47,6 +48,7 @@ module Epp
2003 => 'Required parameter missing',
2004 => 'Parameter value range error',
2005 => 'Parameter value syntax error',
2100 => 'Wrong schema',
2101 => 'Unimplemented command',
2104 => 'Billing failure',
2105 => 'Object is not eligible for renewal',
@ -79,6 +81,7 @@ module Epp
def initialize(value)
value = value.to_i
raise ArgumentError, "Invalid value: #{value}" unless KEY_TO_VALUE.value?(value)
@value = value
end

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('domain:chkData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-eis')) do
xml.tag!('domain:chkData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-ee')) do
@domains.each do |x|
xml.tag!('domain:cd') do
xml.tag!('domain:name', x[:name], 'avail' => x[:avail])

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('domain:creData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-eis')) do
xml.tag!('domain:creData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-ee')) do
xml.tag!('domain:name', @domain.name)
xml.tag!('domain:crDate', @domain.created_at.try(:iso8601))
xml.tag!('domain:exDate', @domain.valid_to.iso8601)

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag! 'domain:infData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-eis') do
xml.tag! 'domain:infData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-ee') do
xml.tag!('domain:name', @domain.name)
xml.tag!('domain:roid', @domain.roid)
@domain.statuses.each do |s|

View file

@ -1,4 +1,4 @@
builder.tag!('domain:trnData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-eis')) do
builder.tag!('domain:trnData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-ee')) do
builder.tag!('domain:name', dt.domain_name)
builder.tag!('domain:trStatus', dt.status)
builder.tag!('domain:reID', dt.new_registrar.code)

View file

@ -5,7 +5,7 @@ xml.epp_head do
end
xml.resData do
xml.tag!('domain:renData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-eis')) do
xml.tag!('domain:renData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-ee')) do
xml.tag!('domain:name', @domain[:name])
xml.tag!('domain:exDate', @domain.valid_to.iso8601)
end

View file

@ -7,7 +7,7 @@ xml.epp_head do
xml.result('code' => x[:code]) do
xml.msg(x[:msg], 'lang' => 'en')
model_name = resource ? resource.model_name.singular.sub('epp_','') : controller.controller_name.singularize
prefix = model_name == 'poll' ? 'changePoll' : model_name + '-eis'
prefix = model_name == 'poll' ? 'changePoll' : model_name + '-ee'
xml.value("xmlns:#{model_name}" => Xsd::Schema.filename(for_prefix: prefix)) do
value = x[:value][:val]

View file

@ -5,7 +5,7 @@ xml.epp_head do
xml.svcMenu do
xml.version '1.0'
xml.lang 'en'
xml.objURI Xsd::Schema.filename(for_prefix: 'domain-eis')
xml.objURI Xsd::Schema.filename(for_prefix: 'domain-ee')
xml.objURI Xsd::Schema.filename(for_prefix: 'contact-ee')
xml.objURI 'urn:ietf:params:xml:ns:host-1.0'
xml.svcExtension do

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<check>
<contact:check
xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
xmlns:contact="contact-ee">
<contact:id>sh8013</contact:id>
</contact:check>
</check>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<check>
<contact:check
xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
xmlns:contact="contact-ee">
<contact:id>sh8013</contact:id>
<contact:id>sh13</contact:id>
<contact:id>vsdfvq</contact:id>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<create>
<contact:create xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
<contact:create xmlns:contact="contact-ee">
<contact:postalInfo>
<contact:name>Sillius Soddus</contact:name>
<contact:addr>
@ -20,7 +20,7 @@
</contact:create>
</create>
<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:legalDocument type="pdf">
dGVzdCBmYWlsCg==

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<delete>
<contact:delete
xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
xmlns:contact="contact-ee">
<contact:id>sh8013</contact:id>
<contact:authInfo>
<contact:pw>wrong-one</contact:pw>
@ -11,7 +11,7 @@
</contact:delete>
</delete>
<extension>
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
<eis:extdata xmlns:eis="eis">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<info>
<contact:info xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
<contact:info xmlns:contact="contact-ee">
<contact:id>sh8013</contact:id>
<contact:authInfo>
<contact:pw>Aas34fq</contact:pw>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<update>
<contact:update xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}">
<contact:update xmlns:contact="contact-ee">
<contact:id>sh8013</contact:id>
<contact:chg>
<contact:postalInfo>
@ -25,7 +25,7 @@
</contact:update>
</update>
<extension>
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
<eis:extdata xmlns:eis="eis">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<check>
<domain:check
xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
xmlns:domain="domain-ee">
<domain:name>example.ee</domain:name>
</domain:check>
</check>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<update>
<domain:update
xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
xmlns:domain="domain-ee">
<domain:name>example.ee</domain:name>
<domain:rem>
<domain:status s="clientHold"/>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<create>
<domain:create
xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
xmlns:domain="domain-ee">
<domain:name>example.ee</domain:name>
<domain:period unit="y">1</domain:period>
<domain:ns>
@ -31,7 +31,7 @@
<secDNS:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</secDNS:pubKey>
</secDNS:keyData>
</secDNS:create>
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
<eis:extdata xmlns:eis="eis">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<delete>
<domain:delete
xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
xmlns:domain="domain-ee">
<domain:name>example.ee</domain:name>
</domain:delete>
</delete>
<extension>
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
<eis:extdata xmlns:eis="eis">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<info>
<domain:info
xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
xmlns:domain="domain-ee">
<domain:name hosts="all">example.ee</domain:name>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<renew>
<domain:renew
xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
xmlns:domain="domain-ee">
<domain:name>example.ee</domain:name>
<domain:curExpDate>2014-08-07</domain:curExpDate>
<domain:period unit="y">1</domain:period>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<transfer op="request">
<domain:transfer
xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
xmlns:domain="domain-ee">
<domain:name>example.ee</domain:name>
<domain:authInfo>
<domain:pw roid="JD1234-REP">2BARfoo</domain:pw>
@ -11,7 +11,7 @@
</domain:transfer>
</transfer>
<extension>
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
<eis:extdata xmlns:eis="eis">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<epp xmlns="epp-ee">
<command>
<update>
<domain:update
xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
xmlns:domain="domain-ee">
<domain:name>example.ee</domain:name>
<domain:add>
<domain:ns>
@ -43,7 +43,7 @@
</secDNS:keyData>
</secDNS:rem>
</secDNS:update>
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis')}">
<eis:extdata xmlns:eis="eis">
<eis:legalDocument type="pdf">
dGVzdCBmYWlsCg==
</eis:legalDocument>

View file

@ -1,5 +1,5 @@
<?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>
<poll op="req"/>
<clTRID>ABC-12345</clTRID>

View file

@ -1 +1 @@
EPP_ALL_SCHEMA = Nokogiri::XML::Schema(File.read('lib/schemas/all-ee-1.1.xsd'))
EPP_ALL_SCHEMA = Nokogiri::XML::Schema(File.read('lib/schemas/all-ee-1.2.xsd'))

View file

@ -34,6 +34,18 @@ Rails.application.routes.draw do
end
end
constraints(EppConstraint.new(:error)) do
controller('errors') do
post 'command/create', to: 'errors#wrong_schema'
post 'command/update', to: 'errors#wrong_schema'
post 'command/info', to: 'errors#wrong_schema'
post 'command/check', to: 'errors#wrong_schema'
post 'command/transfer', to: 'errors#wrong_schema'
post 'command/renew', to: 'errors#wrong_schema'
post 'command/delete', to: 'errors#wrong_schema'
end
end
post 'command/poll', to: 'polls#poll', as: 'poll', constraints: EppConstraint.new(:poll)
get 'error/:command', to: 'errors#error'
get 'error', to: 'errors#command_handler'

View file

@ -1,6 +1,9 @@
class EppConstraint
OBJECT_TYPES = {
domain: { domain: Xsd::Schema.filename(for_prefix: 'domain-eis') },
domain: [
{ domain: Xsd::Schema.filename(for_prefix: 'domain-ee') },
{ domain: Xsd::Schema.filename(for_prefix: 'domain-eis') },
],
contact: { contact: Xsd::Schema.filename(for_prefix: 'contact-ee') },
}.freeze
@ -11,16 +14,45 @@ class EppConstraint
# creates parsed_frame, detects epp request object
def matches?(request)
# TODO: Maybe move this to controller to keep params clean
request.params[:raw_frame] = request.params[:raw_frame].gsub!(/(?<=>)(.*?)(?=<)/) { |s| s.strip} if request.params[:raw_frame]
request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame] || request.params[:frame])
request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces!
return redirect_to_error_controller(request) if request.params[:action] == 'wrong_schema'
request = parse_raw_frame(request) if request.params[:raw_frame]
request = parse_params(request)
unless %i[poll session].include?(@type)
element = "//#{@type}:#{request.params[:action]}"
return false if request.params[:nokogiri_frame].xpath("#{element}", OBJECT_TYPES[@type]).none?
return enumerate_domain_object(request, element) if @type == :domain
return false if request.params[:nokogiri_frame].xpath(element.to_s, OBJECT_TYPES[@type]).none?
end
request.params[:epp_object_type] = @type
true
end
def parse_raw_frame(request)
request.params[:raw_frame] = request.params[:raw_frame].gsub!(/(?<=>)(.*?)(?=<)/, &:strip)
request
end
def enumerate_domain_object(request, element)
OBJECT_TYPES[@type].each do |obj|
return true unless request.params[:nokogiri_frame].xpath(element.to_s, obj).none?
end
false
end
def parse_params(request)
request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame] || request.params[:frame])
request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces!
request
end
def redirect_to_error_controller(request)
request.params[:epp_object_type] = @error
true
end
end

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This schema imports other schemas used for Estonian ccTLD
.ee EPP queries and responses.
-->
<schema targetNamespace="https://epp.tld.ee/schema/all-ee-1.2"
xmlns:all="https://epp.tld.ee/schema/all-ee-1.2"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<!--
Import all schemas related to .ee EPP protocol.
Anytime the version of any imported schema is raised, the version of
'all' schema is also raised.
eppcom and epp schemas never change the version. This would result
in incompatibility with EPP standard.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"
schemaLocation="lib/schemas/eppcom-1.0.xsd"/>
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
schemaLocation="lib/schemas/epp-ee-1.0.xsd"/>
<!-- EPP protocol extension: DNSSEC -->
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1"
schemaLocation="lib/schemas/secDNS-1.1.xsd"/>
<import namespace="urn:ietf:params:xml:ns:host-1.0"
schemaLocation="lib/schemas/host-1.0.xsd"/>
<!-- EPP protocol extension: .ee specific -->
<import namespace="https://epp.tld.ee/schema/eis-1.0"
schemaLocation="lib/schemas/eis-1.0.xsd"/>
<import namespace="https://epp.tld.ee/schema/contact-ee-1.1"
schemaLocation="lib/schemas/contact-ee-1.1.xsd"/>
<import namespace="https://epp.tld.ee/schema/domain-ee-1.1"
schemaLocation="lib/schemas/domain-ee-1.1.xsd"/>
<annotation>
<documentation>
Extensible Provisioning Protocol v1.0
all schema's grouped together
</documentation>
</annotation>
</schema>

View file

@ -0,0 +1,472 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="https://epp.tld.ee/schema/domain-ee-1.1.xsd"
xmlns:domain="https://epp.tld.ee/schema/domain-ee-1.1.xsd"
xmlns:host="urn:ietf:params:xml:ns:host-1.0"
xmlns:epp="https://epp.tld.ee/schema/epp-ee-1.0.xsd"
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<!--
Import common element types.
-->
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0"/>
<import namespace="https://epp.tld.ee/schema/epp-ee-1.0.xsd"/>
<import namespace="urn:ietf:params:xml:ns:host-1.0"/>
<import namespace="urn:ietf:params:xml:ns:secDNS-1.1"/>
<import namespace="https://epp.tld.ee/schema/eis-1.0.xsd"/>
<annotation>
<documentation>
Extensible Provisioning Protocol v1.0
domain provisioning schema.
</documentation>
</annotation>
<!--
Child elements found in EPP commands.
-->
<element name="check" type="domain:mNameType"/>
<element name="create" type="domain:createType"/>
<element name="delete" type="domain:deleteType"/>
<element name="info" type="domain:infoType"/>
<element name="renew" type="domain:renewType"/>
<element name="transfer" type="domain:transferType"/>
<element name="update" type="domain:updateType"/>
<!--
Child elements of the <create> command.
-->
<complexType name="createType">
<sequence>
<element name="name" type="eppcom:labelType"/>
<element name="period" type="domain:periodType"
minOccurs="0"/>
<element name="ns" type="domain:nsType"
minOccurs="0"/>
<element name="registrant" type="eppcom:clIDType"
minOccurs="0"/>
<element name="contact" type="domain:contactType"
minOccurs="0" maxOccurs="unbounded"/>
<element name="authInfo" type="domain:authInfoType" minOccurs="0"/>
</sequence>
</complexType>
<complexType name="periodType">
<simpleContent>
<extension base="domain:pLimitType">
<attribute name="unit" type="domain:pUnitType"
use="required"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="pLimitType">
<restriction base="unsignedShort">
<minInclusive value="1"/>
<maxInclusive value="1095"/>
</restriction>
</simpleType>
<simpleType name="pUnitType">
<restriction base="token">
<enumeration value="y"/>
<enumeration value="m"/>
<enumeration value="d"/>
</restriction>
</simpleType>
<complexType name="nsType">
<choice>
<element name="hostObj" type="eppcom:labelType"
maxOccurs="unbounded"/>
<element name="hostAttr" type="domain:hostAttrType"
maxOccurs="unbounded"/>
</choice>
</complexType>
<!--
Name servers are either host objects or attributes.
-->
<complexType name="hostAttrType">
<sequence>
<element name="hostName" type="eppcom:labelType"/>
<element name="hostAddr" type="host:addrType"
minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<!--
If attributes, addresses are optional and follow the
structure defined in the host mapping.
-->
<complexType name="contactType">
<simpleContent>
<extension base="eppcom:clIDType">
<attribute name="type" type="domain:contactAttrType"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="contactAttrType">
<restriction base="token">
<enumeration value="admin"/>
<enumeration value="billing"/>
<enumeration value="tech"/>
</restriction>
</simpleType>
<complexType name="authInfoType">
<choice>
<element name="pw" type="eppcom:pwAuthInfoType"/>
<element name="ext" type="eppcom:extAuthInfoType"/>
</choice>
</complexType>
<!--
Child element of commands that require a single name.
-->
<complexType name="sNameType">
<sequence>
<element name="name" type="eppcom:labelType"/>
</sequence>
</complexType>
<!--
Child element of commands that accept multiple names.
-->
<complexType name="mNameType">
<sequence>
<element name="name" type="eppcom:labelType"
maxOccurs="unbounded"/>
</sequence>
</complexType>
<!--
Child element of the <delete> command - .ee specific (verified)
-->
<complexType name="deleteType">
<sequence>
<element name="name" type="eppcom:labelType"/>
</sequence>
<attribute name="verified" type="domain:verifiedType"
use="optional"/>
</complexType>
<!--
Child elements of the <info> command.
-->
<complexType name="infoType">
<sequence>
<element name="name" type="domain:infoNameType"/>
<element name="authInfo" type="domain:authInfoType"
minOccurs="0"/>
</sequence>
</complexType>
<complexType name="infoNameType">
<simpleContent>
<extension base = "eppcom:labelType">
<attribute name="hosts" type="domain:hostsType"
default="all"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="hostsType">
<restriction base="token">
<enumeration value="all"/>
<enumeration value="del"/>
<enumeration value="none"/>
<enumeration value="sub"/>
</restriction>
</simpleType>
<!--
Child elements of the <renew> command.
-->
<complexType name="renewType">
<sequence>
<element name="name" type="eppcom:labelType"/>
<element name="curExpDate" type="date"/>
<element name="period" type="domain:periodType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
Child elements of the <transfer> command.
-->
<complexType name="transferType">
<sequence>
<element name="name" type="eppcom:labelType"/>
<element name="period" type="domain:periodType"
minOccurs="0"/>
<element name="authInfo" type="domain:authInfoType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
Child elements of the <update> command.
-->
<complexType name="updateType">
<sequence>
<element name="name" type="eppcom:labelType"/>
<element name="add" type="domain:addRemType"
minOccurs="0"/>
<element name="rem" type="domain:addRemType"
minOccurs="0"/>
<element name="chg" type="domain:chgType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
Data elements that can be added or removed.
-->
<complexType name="addRemType">
<sequence>
<element name="ns" type="domain:nsType"
minOccurs="0"/>
<element name="contact" type="domain:contactType"
minOccurs="0" maxOccurs="unbounded"/>
<element name="status" type="domain:statusType"
minOccurs="0" maxOccurs="11"/>
</sequence>
</complexType>
<!--
Data elements that can be changed.
-->
<complexType name="chgType">
<sequence>
<element name="registrant" type="domain:clIDChgType"
minOccurs="0"/>
<element name="authInfo" type="domain:authInfoChgType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
Allow the registrant value to be nullified by changing the
minLength restriction to "0".
-->
<complexType name="clIDChgType">
<simpleContent>
<extension base="domain:clIDChgSimpleType">
<attribute name="verified" type="domain:verifiedType"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="clIDChgSimpleType">
<restriction base="token">
<minLength value="0"/>
</restriction>
</simpleType>
<simpleType name="verifiedType">
<restriction base="token">
<enumeration value="yes"/>
<enumeration value="no"/>
</restriction>
</simpleType>
<!--
Allow the authInfo value to be nullified by including an
empty element within the choice.
-->
<complexType name="authInfoChgType">
<choice>
<element name="pw" type="eppcom:pwAuthInfoType"/>
<element name="ext" type="eppcom:extAuthInfoType"/>
<element name="null"/>
</choice>
</complexType>
<!--
Child response elements.
-->
<element name="chkData" type="domain:chkDataType"/>
<element name="creData" type="domain:creDataType"/>
<element name="infData" type="domain:infDataType"/>
<element name="panData" type="domain:panDataType"/>
<element name="renData" type="domain:renDataType"/>
<element name="trnData" type="domain:trnDataType"/>
<!--
<check> response elements.
-->
<complexType name="chkDataType">
<sequence>
<element name="cd" type="domain:checkType"
maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="checkType">
<sequence>
<element name="name" type="domain:checkNameType"/>
<element name="reason" type="eppcom:reasonType"
minOccurs="0"/>
</sequence>
</complexType>
<complexType name="checkNameType">
<simpleContent>
<extension base="eppcom:labelType">
<attribute name="avail" type="boolean"
use="required"/>
</extension>
</simpleContent>
</complexType>
<!--
<create> response elements.
-->
<complexType name="creDataType">
<sequence>
<element name="name" type="eppcom:labelType"/>
<element name="crDate" type="dateTime"/>
<element name="exDate" type="dateTime"
minOccurs="0"/>
</sequence>
</complexType>
<!--
<info> response elements.
-->
<complexType name="infDataType">
<sequence>
<element name="name" type="eppcom:labelType"/>
<element name="roid" type="eppcom:roidType"/>
<element name="status" type="domain:statusType"
minOccurs="0" maxOccurs="11"/>
<element name="registrant" type="eppcom:clIDType"
minOccurs="0"/>
<element name="contact" type="domain:contactType"
minOccurs="0" maxOccurs="unbounded"/>
<element name="ns" type="domain:nsType"
minOccurs="0"/>
<element name="host" type="eppcom:labelType"
minOccurs="0" maxOccurs="unbounded"/>
<element name="clID" type="eppcom:clIDType"/>
<element name="crID" type="eppcom:clIDType"
minOccurs="0"/>
<element name="crDate" type="dateTime"
minOccurs="0"/>
<element name="upID" type="eppcom:clIDType"
minOccurs="0"/>
<element name="upDate" type="dateTime"
minOccurs="0"/>
<element name="exDate" type="dateTime"
minOccurs="0"/>
<element name="trDate" type="dateTime"
minOccurs="0"/>
<element name="authInfo" type="domain:authInfoType"
minOccurs="0"/>
</sequence>
</complexType>
<!--
Status is a combination of attributes and an optional
human-readable message that may be expressed in languages other
than English.
-->
<complexType name="statusType">
<simpleContent>
<extension base="normalizedString">
<attribute name="s" type="domain:statusValueType"
use="required"/>
<attribute name="lang" type="language"
default="en"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="statusValueType">
<restriction base="token">
<enumeration value="clientDeleteProhibited"/>
<enumeration value="clientHold"/>
<enumeration value="clientRenewProhibited"/>
<enumeration value="clientTransferProhibited"/>
<enumeration value="clientUpdateProhibited"/>
<enumeration value="inactive"/>
<enumeration value="ok"/>
<enumeration value="expired"/>
<enumeration value="pendingCreate"/>
<enumeration value="pendingDelete"/>
<enumeration value="pendingRenew"/>
<enumeration value="pendingTransfer"/>
<enumeration value="pendingUpdate"/>
<enumeration value="pendingDeleteConfirmation"/>
<enumeration value="serverDeleteProhibited"/>
<enumeration value="serverHold"/>
<enumeration value="serverRenewProhibited"/>
<enumeration value="serverTransferProhibited"/>
<enumeration value="serverUpdateProhibited"/>
<enumeration value="serverForceDelete"/>
<enumeration value="serverManualInzone"/>
<enumeration value="serverRegistrantChangeProhibited"/>
<enumeration value="serverAdminChangeProhibited"/>
<enumeration value="serverTechChangeProhibited"/>
<enumeration value="deleteCandidate"/>
<enumeration value="disputed"/>
<enumeration value="serverReleaseProhibited"/>
</restriction>
</simpleType>
<!--
Pending action notification response elements.
-->
<complexType name="panDataType">
<sequence>
<element name="name" type="domain:paNameType"/>
<element name="paTRID" type="epp:trIDType"/>
<element name="paDate" type="dateTime"/>
</sequence>
</complexType>
<complexType name="paNameType">
<simpleContent>
<extension base="eppcom:labelType">
<attribute name="paResult" type="boolean"
use="required"/>
</extension>
</simpleContent>
</complexType>
<!--
<renew> response elements.
-->
<complexType name="renDataType">
<sequence>
<element name="name" type="eppcom:labelType"/>
<element name="exDate" type="dateTime"
minOccurs="0"/>
</sequence>
</complexType>
<!--
<transfer> response elements.
-->
<complexType name="trnDataType">
<sequence>
<element name="name" type="eppcom:labelType"/>
<element name="trStatus" type="eppcom:trStatusType"/>
<element name="reID" type="eppcom:clIDType"/>
<element name="reDate" type="dateTime"/>
<element name="acID" type="eppcom:clIDType"/>
<element name="acDate" type="dateTime"/>
<element name="exDate" type="dateTime"
minOccurs="0"/>
</sequence>
</complexType>
<!--
End of schema.
-->
</schema>

View file

@ -3,6 +3,22 @@ module Xsd
SCHEMA_PATH = 'lib/schemas/'.freeze
BASE_URL = 'https://epp.tld.ee/schema/'.freeze
PREFIXES = %w[
domain-ee
domain-eis
all-ee
changePoll
contact
contact-ee
contact-eis
eis
epp
epp-ee
eppcom
host
secDNS
].freeze
attr_reader :xsd_schemas, :for_prefix
def initialize(params)

View file

@ -18,7 +18,7 @@ class AdminAreaBlockedDomainsIntegrationTest < JavaScriptApplicationSystemTestCa
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant>#{new_registrant.code}</domain:registrant>
@ -53,7 +53,7 @@ class AdminAreaBlockedDomainsIntegrationTest < JavaScriptApplicationSystemTestCa
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant>#{new_registrant.code}</domain:registrant>

View file

@ -18,25 +18,44 @@ class EppBaseTest < EppTestCase
def test_internal_error
Rails.application.routes.draw do
post 'epp/command/internal_error', to: 'dummy_epp#internal_error',
constraints: EppConstraint.new(:poll)
constraints: EppConstraint.new(:poll)
end
begin
assert_difference 'ApiLog::EppLog.count' do
post '/epp/command/internal_error', params: { frame: valid_request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :command_failed
rescue
rescue StandardError
raise
ensure
Rails.application.reload_routes!
end
end
def test_wrong_path_xml
wrong_path_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="https://dsfs.sdf.sdf">
<domain:name>#{domains(:shop).name}</domain:name>
</domain:info>
</info>
</command>
</epp>
XML
post epp_info_path, params: { frame: wrong_path_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_epp_response :wrong_schema
end
def test_additional_error
get '/epp/error', params: { frame: valid_request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_epp_response :unknown_command
end
@ -49,7 +68,7 @@ class EppBaseTest < EppTestCase
XML
get '/epp/error', params: { frame: invalid_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_epp_response :unknown_command
end
@ -61,7 +80,7 @@ class EppBaseTest < EppTestCase
</epp>
XML
post valid_command_path, params: { frame: invalid_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_epp_response :required_parameter_missing
end
@ -72,7 +91,7 @@ class EppBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domains(:shop).name}</domain:name>
</domain:info>
</info>
@ -80,7 +99,7 @@ class EppBaseTest < EppTestCase
</epp>
XML
post epp_info_path, params: { frame: xml_of_epp_command_that_requires_authentication },
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
assert_epp_response :authorization_error
end
@ -96,7 +115,7 @@ class EppBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domains(:shop).name}</domain:name>
</domain:info>
</info>
@ -104,7 +123,7 @@ class EppBaseTest < EppTestCase
</epp>
XML
post epp_info_path, params: { frame: xml_of_epp_command_that_requires_authorization },
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
assert_epp_response :authorization_error
end
@ -122,7 +141,7 @@ class EppBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domains(:shop).name}</domain:name>
</domain:info>
</info>
@ -130,7 +149,7 @@ class EppBaseTest < EppTestCase
</epp>
XML
post '/epp/command/info', params: { frame: authentication_enabled_epp_request_xml },
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
assert_epp_response :authorization_error
assert_nil EppSession.find_by(session_id: session.session_id)
@ -149,7 +168,7 @@ class EppBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domains(:shop).name}</domain:name>
</domain:info>
</info>
@ -158,7 +177,7 @@ class EppBaseTest < EppTestCase
XML
post '/epp/command/info', params: { frame: authentication_enabled_epp_request_xml },
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
session.reload

View file

@ -7,7 +7,7 @@ class EppDomainBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>non-existent.test</domain:name>
</domain:info>
</info>
@ -15,8 +15,27 @@ class EppDomainBaseTest < EppTestCase
</epp>
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_epp_response :object_does_not_exist
end
def test_invalid_path
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="https://afdsfs.dfdf.df">
<domain:name>non-existent.test</domain:name>
</domain:info>
</info>
</command>
</epp>
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_epp_response :wrong_schema
end
end

View file

@ -20,7 +20,7 @@ class EppDomainCheckAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>auction.test</domain:name>
</domain:check>
</check>
@ -33,8 +33,8 @@ class EppDomainCheckAuctionTest < EppTestCase
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_idn_ascii_domain_is_unavailable_when_at_auction
@ -45,7 +45,7 @@ class EppDomainCheckAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>xn--pramiid-n2a.test</domain:name>
</domain:check>
</check>
@ -58,8 +58,8 @@ class EppDomainCheckAuctionTest < EppTestCase
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_idn_unicode_domain_is_unavailable_when_at_auction
@ -70,7 +70,7 @@ class EppDomainCheckAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>püramiid.test</domain:name>
</domain:check>
</check>
@ -83,8 +83,8 @@ class EppDomainCheckAuctionTest < EppTestCase
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_domain_is_unavailable_when_awaiting_payment
@ -95,7 +95,7 @@ class EppDomainCheckAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>auction.test</domain:name>
</domain:check>
</check>
@ -108,8 +108,8 @@ class EppDomainCheckAuctionTest < EppTestCase
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_equal 'Awaiting payment', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Awaiting payment', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_domain_is_available_when_payment_received
@ -120,7 +120,7 @@ class EppDomainCheckAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>auction.test</domain:name>
</domain:check>
</check>
@ -133,7 +133,7 @@ class EppDomainCheckAuctionTest < EppTestCase
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")
end
end

View file

@ -7,7 +7,7 @@ class EppDomainCheckBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>some.test</domain:name>
</domain:check>
</check>
@ -20,7 +20,7 @@ class EppDomainCheckBaseTest < EppTestCase
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal 'some.test', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal 'some.test', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_domain_is_available_when_not_registered_or_blocked
@ -29,7 +29,7 @@ class EppDomainCheckBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>available.test</domain:name>
</domain:check>
</check>
@ -41,8 +41,8 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")
end
def test_domain_is_available_when_reserved
@ -53,7 +53,7 @@ class EppDomainCheckBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>reserved.test</domain:name>
</domain:check>
</check>
@ -65,8 +65,8 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")
end
def test_domain_is_unavailable_when_format_is_invalid
@ -75,7 +75,7 @@ class EppDomainCheckBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>invalid</domain:name>
</domain:check>
</check>
@ -87,8 +87,8 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_equal 'invalid format', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'invalid format', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_domain_is_unavailable_when_registered
@ -99,7 +99,7 @@ class EppDomainCheckBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:check>
</check>
@ -111,8 +111,8 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_equal 'in use', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'in use', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_domain_is_unavailable_when_blocked
@ -123,7 +123,7 @@ class EppDomainCheckBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>blocked.test</domain:name>
</domain:check>
</check>
@ -135,8 +135,8 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_equal 'Blocked', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Blocked', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_domain_is_unavailable_when_zone_with_the_same_origin_exists
@ -147,7 +147,7 @@ class EppDomainCheckBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>test</domain:name>
</domain:check>
</check>
@ -159,8 +159,8 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail']
assert_equal 'Zone with the same origin exists', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Zone with the same origin exists', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_multiple_domains
@ -169,7 +169,7 @@ class EppDomainCheckBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<check>
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:check xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>one.test</domain:name>
<domain:name>two.test</domain:name>
<domain:name>three.test</domain:name>
@ -183,6 +183,6 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_equal 3, response_xml.xpath('//domain:cd', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").size
assert_equal 3, response_xml.xpath('//domain:cd', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").size
end
end

View file

@ -24,7 +24,7 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>xn--pramiid-n2a.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -59,7 +59,7 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>püramiid.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -93,7 +93,7 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>xn--pramiid-n2a.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -127,7 +127,7 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>püramiid.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -162,7 +162,7 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>püramiid.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -199,7 +199,7 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>xn--pramiid-n2a.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>

View file

@ -16,7 +16,7 @@ class EppDomainCreateAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>not-at-auction.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -51,7 +51,7 @@ class EppDomainCreateAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>auction.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -84,7 +84,7 @@ class EppDomainCreateAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>auction.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -120,7 +120,7 @@ class EppDomainCreateAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>auction.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -150,7 +150,7 @@ class EppDomainCreateAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>auction.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -182,7 +182,7 @@ class EppDomainCreateAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>auction.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -214,7 +214,7 @@ class EppDomainCreateAuctionTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>auction.test</domain:name>
</domain:create>
</create>

View file

@ -17,7 +17,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
</domain:create>
@ -56,7 +56,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
</domain:create>
@ -89,7 +89,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
</domain:create>
@ -125,7 +125,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
</domain:create>
@ -161,7 +161,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
</domain:create>
@ -190,7 +190,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contacts(:jane).code}</domain:contact>
@ -226,7 +226,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contact.code}</domain:contact>
@ -264,7 +264,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contact.code}</domain:contact>
@ -301,7 +301,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contact.code}</domain:contact>
@ -339,7 +339,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contact.code}</domain:contact>
@ -377,7 +377,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contact_two.code}</domain:contact>
@ -414,7 +414,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
</domain:create>
@ -462,7 +462,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
</domain:create>
@ -498,7 +498,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
</domain:create>
@ -532,7 +532,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{reserved_domain.name}</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -568,7 +568,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{name}</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
<domain:authInfo>
@ -601,7 +601,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{blocked_domain}</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -631,7 +631,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{SimpleIDN.to_ascii('blockedäöüõ.test')}</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -658,7 +658,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{reserved_domains(:one).name}</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -690,7 +690,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{reserved_domain.name}</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -720,7 +720,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>new.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
@ -748,7 +748,7 @@ class EppDomainCreateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>new.test</domain:name>
<domain:period unit="m">2</domain:period>
<domain:registrant>john-001</domain:registrant>

View file

@ -21,7 +21,7 @@ class EppDomainDeleteBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<delete>
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>invalid.test</domain:name>
</domain:delete>
</delete>
@ -48,7 +48,7 @@ class EppDomainDeleteBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<delete>
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:delete>
</delete>
@ -76,7 +76,7 @@ class EppDomainDeleteBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<delete>
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:delete>
</delete>
@ -110,7 +110,7 @@ class EppDomainDeleteBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<delete>
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:delete>
</delete>
@ -144,7 +144,7 @@ class EppDomainDeleteBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<delete>
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:delete>
</delete>
@ -177,7 +177,7 @@ class EppDomainDeleteBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<delete>
<domain:delete verified="yes" xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:delete verified="yes" xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:delete>
</delete>
@ -210,7 +210,7 @@ class EppDomainDeleteBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<delete>
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:delete>
</delete>
@ -232,7 +232,7 @@ class EppDomainDeleteBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<delete>
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:delete xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:delete>
</delete>

View file

@ -13,7 +13,7 @@ class EppDomainInfoBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:info>
</info>
@ -22,19 +22,33 @@ class EppDomainInfoBaseTest < EppTestCase
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal 'shop.test', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal 'ok', response_xml.at_xpath('//domain:status', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['s']
assert_equal 'john-001', response_xml.at_xpath('//domain:registrant', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '2010-07-05T00:00:00+03:00', response_xml.at_xpath('//domain:crDate', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '2010-07-06T00:00:00+03:00', response_xml.at_xpath('//domain:upDate', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '2010-07-07T00:00:00+03:00', response_xml.at_xpath('//domain:exDate', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert assert_schema_is_bigger(response_xml, 'domain-ee', 1.1)
assert_equal 'shop.test',
response_xml.at_xpath('//domain:name',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s).text
assert_equal 'ok',
response_xml.at_xpath('//domain:status',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s)['s']
assert_equal 'john-001',
response_xml.at_xpath('//domain:registrant',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s).text
assert_equal '2010-07-05T00:00:00+03:00',
response_xml.at_xpath('//domain:crDate',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s).text
assert_equal '2010-07-06T00:00:00+03:00',
response_xml.at_xpath('//domain:upDate',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s).text
assert_equal '2010-07-07T00:00:00+03:00',
response_xml.at_xpath('//domain:exDate',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s).text
end
def test_returns_valid_response_if_disputed
def test_returns_valid_response_if_schema_version_is_previous
dispute = disputes(:expired)
dispute.update!(starts_at: Time.zone.now, expires_at: Time.zone.now + 5.days, closed: nil)
@ -61,7 +75,75 @@ class EppDomainInfoBaseTest < EppTestCase
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
schema = EPP_ALL_SCHEMA
schema_validation_errors = schema.validate(response_xml)
assert_equal 0, schema_validation_errors.size
end
def test_returns_valid_response_if_disputed
dispute = disputes(:expired)
dispute.update!(starts_at: Time.zone.now, expires_at: Time.zone.now + 5.days, closed: nil)
domain = domains(:shop)
domain.update_columns(statuses: [DomainStatus::DISPUTED],
created_at: Time.zone.parse('2010-07-05'),
updated_at: Time.zone.parse('2010-07-06'),
creator_str: 'test',
valid_to: Time.zone.parse('2010-07-07'))
domain.versions.destroy_all
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:info>
</info>
</command>
</epp>
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
schema = EPP_ALL_SCHEMA
schema_validation_errors = schema.validate(response_xml)
assert_equal 0, schema_validation_errors.size
end
def test_returns_valid_response_if_release_prohibited
domain = domains(:shop)
domain.update_columns(statuses: [DomainStatus::SERVER_RELEASE_PROHIBITED],
created_at: Time.now - 5.days,
creator_str: 'test',
delete_date: Time.now - 1.day)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:info>
</info>
</command>
</epp>
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
@ -79,7 +161,7 @@ class EppDomainInfoBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:info>
</info>
@ -88,10 +170,12 @@ class EppDomainInfoBaseTest < EppTestCase
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '65078d5',
response_xml.at_xpath('//domain:authInfo/domain:pw',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s).text
end
# Transfer code is the only info we conceal from other registrars, hence a bit oddly-looking
@ -104,7 +188,7 @@ class EppDomainInfoBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
<domain:authInfo>
<domain:pw>65078d5</domain:pw>
@ -116,10 +200,12 @@ class EppDomainInfoBaseTest < EppTestCase
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
response_xml = Nokogiri::XML(response.body)
assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal '65078d5',
response_xml.at_xpath('//domain:authInfo/domain:pw',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s).text
end
def test_conceals_transfer_code_when_domain_is_not_owned_by_current_user
@ -128,7 +214,7 @@ class EppDomainInfoBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
<domain:authInfo>
<domain:pw></domain:pw>
@ -140,10 +226,10 @@ class EppDomainInfoBaseTest < EppTestCase
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
response_xml = Nokogiri::XML(response.body)
assert_nil response_xml.at_xpath('//domain:authInfo/domain:pw',
'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s)
end
end

View file

@ -14,7 +14,7 @@ class EppDomainRenewBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<renew>
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domain.name}</domain:name>
<domain:curExpDate>#{domain.expire_time.to_date}</domain:curExpDate>
<domain:period unit="y">1</domain:period>
@ -45,7 +45,7 @@ class EppDomainRenewBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<renew>
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domain.name}</domain:name>
<domain:curExpDate>#{domain.expire_time.to_date}</domain:curExpDate>
<domain:period unit="y">1</domain:period>
@ -72,7 +72,7 @@ class EppDomainRenewBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<renew>
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domain.name}</domain:name>
<domain:curExpDate>#{domain.valid_to.to_date}</domain:curExpDate>
<domain:period unit="m">1</domain:period>
@ -100,7 +100,7 @@ class EppDomainRenewBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<renew>
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domain.name}</domain:name>
<domain:curExpDate>#{domain.valid_to.to_date}</domain:curExpDate>
<domain:period unit="m">1</domain:period>
@ -128,7 +128,7 @@ class EppDomainRenewBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<renew>
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domain.name}</domain:name>
<domain:curExpDate>#{domain.expire_time.to_date}</domain:curExpDate>
<domain:period unit="y">1</domain:period>
@ -155,7 +155,7 @@ class EppDomainRenewBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<renew>
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domain.name}</domain:name>
<domain:curExpDate>#{domain.expire_time.to_date}</domain:curExpDate>
<domain:period unit="m">2</domain:period>
@ -183,7 +183,7 @@ class EppDomainRenewBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<renew>
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domain.name}</domain:name>
<domain:curExpDate>#{provided_expiration_date}</domain:curExpDate>
</domain:renew>
@ -214,7 +214,7 @@ class EppDomainRenewBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<renew>
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:renew xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{domain.name}</domain:name>
<domain:curExpDate>#{domain.expire_time.to_date}</domain:curExpDate>
<domain:period unit="y">1</domain:period>

View file

@ -6,10 +6,10 @@ class EppDomainTransferQueryTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
xml_doc = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal 'shop.test', xml_doc.xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal 'serverApproved', xml_doc.xpath('//domain:trStatus', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal 'goodnames', xml_doc.xpath('//domain:reID', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal 'bestnames', xml_doc.xpath('//domain:acID', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal 'shop.test', xml_doc.xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
assert_equal 'serverApproved', xml_doc.xpath('//domain:trStatus', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
assert_equal 'goodnames', xml_doc.xpath('//domain:reID', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
assert_equal 'bestnames', xml_doc.xpath('//domain:acID', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_wrong_transfer_code
@ -18,7 +18,7 @@ class EppDomainTransferQueryTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<transfer op="query">
<domain:transfer xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:transfer xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
<domain:authInfo>
<domain:pw>wrong</domain:pw>
@ -50,7 +50,7 @@ class EppDomainTransferQueryTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<transfer op="query">
<domain:transfer xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:transfer xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
<domain:authInfo>
<domain:pw>65078d5</domain:pw>

View file

@ -119,7 +119,7 @@ class EppDomainTransferRequestTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_equal 'serverApproved', Nokogiri::XML(response.body).xpath('//domain:trStatus', 'domain' =>
"#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
"#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_assigns_new_registrar
@ -204,7 +204,7 @@ class EppDomainTransferRequestTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<transfer op="request">
<domain:transfer xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:transfer xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
<domain:authInfo>
<domain:pw>wrong</domain:pw>
@ -231,7 +231,7 @@ class EppDomainTransferRequestTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<transfer op="request">
<domain:transfer xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:transfer xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
<domain:authInfo>
<domain:pw>65078d5</domain:pw>

View file

@ -23,7 +23,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
<domain:chg>
<domain:authInfo>
@ -51,7 +51,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:update>
</update>
@ -72,7 +72,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
</domain:update>
</update>
@ -93,7 +93,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
</domain:update>
</update>
@ -106,7 +106,7 @@ class EppDomainUpdateBaseTest < EppTestCase
assert_epp_response :object_status_prohibits_operation
response_xml = Nokogiri::XML(response.body)
assert_equal DomainStatus::PENDING_UPDATE, response_xml.at_xpath('//domain:status', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal DomainStatus::PENDING_UPDATE, response_xml.at_xpath('//domain:status', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
def test_requires_verification_from_current_registrant_when_provided_registrant_is_a_new_one
@ -119,7 +119,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant>#{new_registrant.code}</domain:registrant>
@ -163,7 +163,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant verified="no">#{new_registrant.code}</domain:registrant>
@ -198,7 +198,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant verified="no">#{new_registrant.code}</domain:registrant>
@ -241,7 +241,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant verified="no">#{new_registrant.code}</domain:registrant>
@ -277,7 +277,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant verified="no">#{new_registrant.code}</domain:registrant>
@ -311,7 +311,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant>#{new_registrant.code}</domain:registrant>
@ -345,7 +345,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant>#{@domain.registrant.code}</domain:registrant>
@ -384,7 +384,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant>#{new_registrant.code}</domain:registrant>
@ -427,7 +427,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant verified="yes">#{new_registrant.code}</domain:registrant>
@ -466,7 +466,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant>#{new_registrant.code}</domain:registrant>
@ -503,7 +503,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant verified="yes">#{new_registrant.code}</domain:registrant>
@ -542,7 +542,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant verified="yes">#{new_registrant.code}</domain:registrant>
@ -579,7 +579,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:rem>
<domain:ns>
@ -611,7 +611,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
<domain:add>
<domain:status s="clientHold" lang="en">Test</domain:status>
@ -639,7 +639,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>shop.test</domain:name>
<domain:rem>
<domain:status s="clientHold" lang="en">Test</domain:status>
@ -664,7 +664,7 @@ class EppDomainUpdateBaseTest < EppTestCase
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
<domain:name>#{@domain.name}</domain:name>
<domain:rem>
<domain:status s="clientHold"/>

View file

@ -25,7 +25,7 @@ class EppLoginTest < EppTestCase
<lang>en</lang>
</options>
<svcs>
<objURI>#{Xsd::Schema.filename(for_prefix: 'domain-eis')}</objURI>
<objURI>#{Xsd::Schema.filename(for_prefix: 'domain-ee')}</objURI>
<objURI>#{Xsd::Schema.filename(for_prefix: 'contact-ee')}</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
@ -60,7 +60,7 @@ class EppLoginTest < EppTestCase
<lang>en</lang>
</options>
<svcs>
<objURI>#{Xsd::Schema.filename(for_prefix: 'domain-eis')}</objURI>
<objURI>#{Xsd::Schema.filename(for_prefix: 'domain-ee')}</objURI>
<objURI>#{Xsd::Schema.filename(for_prefix: 'contact-ee')}</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
@ -94,7 +94,7 @@ class EppLoginTest < EppTestCase
<lang>en</lang>
</options>
<svcs>
<objURI>#{Xsd::Schema.filename(for_prefix: 'domain-eis')}</objURI>
<objURI>#{Xsd::Schema.filename(for_prefix: 'domain-ee')}</objURI>
<objURI>#{Xsd::Schema.filename(for_prefix: 'contact-ee')}</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
@ -129,7 +129,7 @@ class EppLoginTest < EppTestCase
<lang>en</lang>
</options>
<svcs>
<objURI>#{Xsd::Schema.filename(for_prefix: 'domain-eis')}</objURI>
<objURI>#{Xsd::Schema.filename(for_prefix: 'domain-ee')}</objURI>
<objURI>#{Xsd::Schema.filename(for_prefix: 'contact-ee')}</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
@ -164,7 +164,7 @@ class EppLoginTest < EppTestCase
<lang>en</lang>
</options>
<svcs>
<objURI>#{Xsd::Schema.filename(for_prefix: 'domain-eis')}</objURI>
<objURI>#{Xsd::Schema.filename(for_prefix: 'domain-ee')}</objURI>
<objURI>#{Xsd::Schema.filename(for_prefix: 'contact-ee')}</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>

View 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: { 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

View file

@ -15,7 +15,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
end
def test_invalid_code_value
invalid_code_value = 0000
invalid_code_value = 0o000
refute_includes Epp::Response::Result::Code.codes.values, invalid_code_value
e = assert_raises ArgumentError do
@ -38,6 +38,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
required_parameter_missing: 2003,
parameter_value_range_error: 2004,
parameter_value_syntax_error: 2005,
wrong_schema: 2100,
billing_failure: 2104,
unimplemented: 2101,
object_is_not_eligible_for_renewal: 2105,
@ -51,7 +52,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
data_management_policy_violation: 2308,
command_failed: 2400,
authentication_error_server_closing_connection: 2501,
session_limit_exceeded_server_closing_connection: 2502,
session_limit_exceeded_server_closing_connection: 2502
}
assert_equal codes, Epp::Response::Result::Code.codes
end
@ -70,6 +71,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
2003 => 'Required parameter missing',
2004 => 'Parameter value range error',
2005 => 'Parameter value syntax error',
2100 => 'Wrong schema',
2101 => 'Unimplemented command',
2104 => 'Billing failure',
2105 => 'Object is not eligible for renewal',
@ -83,7 +85,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
2308 => 'Data management policy violation',
2400 => 'Command failed',
2501 => 'Authentication error; server closing connection',
2502 => 'Session limit exceeded; server closing connection',
2502 => 'Session limit exceeded; server closing connection'
}
assert_equal descriptions, Epp::Response::Result::Code.default_descriptions
end

View file

@ -0,0 +1,33 @@
require 'application_system_test_case'
class RegistrarAreaXmlConsolesTest < ApplicationSystemTestCase
setup do
sign_in users(:api_bestnames)
end
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
<<~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
end

View file

@ -22,7 +22,6 @@ require 'sidekiq/testing'
Sidekiq::Testing.fake!
# `bin/rails test` is not the same as `bin/rake test`.
# All tasks will be loaded (and executed) twice when using the former without `Rake::Task.clear`.
# https://github.com/rails/rails/issues/28786
@ -69,4 +68,24 @@ end
class EppTestCase < ActionDispatch::IntegrationTest
include Assertions::EppAssertions
def assert_schema_is_bigger(response_xml, prefix, version)
schema_version = prefix_schema_tag(prefix, response_xml)
assert schema_version >= version
end
private
def prefix_schema_tag(prefix, response_xml)
if Xsd::Schema::PREFIXES.include? prefix
version_regex = /-\d+\S\d+/
domain_schema_tag = response_xml.to_s.scan(%r{https://epp.tld.ee/schema/#{prefix}\S+})
version = domain_schema_tag.to_s.match(version_regex)[0]
-version.to_f
else
raise Exception.new('Wrong prefix')
end
end
end