mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Fix tests
This commit is contained in:
parent
218caa892e
commit
f0268a635a
3 changed files with 23 additions and 19 deletions
|
@ -51,6 +51,7 @@ class Epp::DomainsController < EppController
|
||||||
# @domain.parse_and_update_domain_dependencies(params[:parsed_frame].css('chg'))
|
# @domain.parse_and_update_domain_dependencies(params[:parsed_frame].css('chg'))
|
||||||
# @domain.attach_legal_document(Epp::EppDomain.parse_legal_document_from_frame(params[:parsed_frame]))
|
# @domain.attach_legal_document(Epp::EppDomain.parse_legal_document_from_frame(params[:parsed_frame]))
|
||||||
# binding.pry
|
# binding.pry
|
||||||
|
|
||||||
if @domain.update(params[:parsed_frame], current_user)
|
if @domain.update(params[:parsed_frame], current_user)
|
||||||
render_epp_response '/epp/domains/success'
|
render_epp_response '/epp/domains/success'
|
||||||
else
|
else
|
||||||
|
|
|
@ -68,12 +68,14 @@ class Epp::EppDomain < Domain
|
||||||
at = {}.with_indifferent_access
|
at = {}.with_indifferent_access
|
||||||
|
|
||||||
code = frame.css('registrant').first.try(:text)
|
code = frame.css('registrant').first.try(:text)
|
||||||
oc = Contact.find_by(code: code).try(:id)
|
if code.present?
|
||||||
|
oc = Contact.find_by(code: code).try(:id)
|
||||||
|
|
||||||
if oc
|
if oc
|
||||||
at[:owner_contact_id] = oc
|
at[:owner_contact_id] = oc
|
||||||
else
|
else
|
||||||
add_epp_error('2303', 'registrant', code, [:owner_contact, :not_found])
|
add_epp_error('2303', 'registrant', code, [:owner_contact, :not_found])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
at[:name] = frame.css('name').text if new_record?
|
at[:name] = frame.css('name').text if new_record?
|
||||||
|
@ -109,7 +111,7 @@ class Epp::EppDomain < Domain
|
||||||
ns_list.each do |ns_attrs|
|
ns_list.each do |ns_attrs|
|
||||||
nameserver = nameservers.where(ns_attrs).try(:first)
|
nameserver = nameservers.where(ns_attrs).try(:first)
|
||||||
if nameserver.blank?
|
if nameserver.blank?
|
||||||
add_epp_error('2303', 'hostAttr', ns_attrs[:hostname], I18n.t('nameserver_not_found'))
|
add_epp_error('2303', 'hostAttr', ns_attrs[:hostname], [:nameservers, :not_found])
|
||||||
else
|
else
|
||||||
to_destroy << {
|
to_destroy << {
|
||||||
id: nameserver.id,
|
id: nameserver.id,
|
||||||
|
@ -130,7 +132,13 @@ class Epp::EppDomain < Domain
|
||||||
if action == 'rem'
|
if action == 'rem'
|
||||||
to_destroy = []
|
to_destroy = []
|
||||||
contact_list.each do |dc|
|
contact_list.each do |dc|
|
||||||
domain_contact_id = domain_contacts.find_by(contact_id: dc[:contact_id]).id
|
domain_contact_id = domain_contacts.find_by(contact_id: dc[:contact_id]).try(:id)
|
||||||
|
|
||||||
|
unless domain_contact_id
|
||||||
|
add_epp_error('2303', 'contact', dc[:contact_code_cache], [:domain_contacts, :not_found])
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
to_destroy << {
|
to_destroy << {
|
||||||
id: domain_contact_id,
|
id: domain_contact_id,
|
||||||
_destroy: 1
|
_destroy: 1
|
||||||
|
@ -148,12 +156,6 @@ class Epp::EppDomain < Domain
|
||||||
frame.css('contact').each do |x|
|
frame.css('contact').each do |x|
|
||||||
c = Contact.find_by(code: x.text)
|
c = Contact.find_by(code: x.text)
|
||||||
|
|
||||||
# contact = Contact.find_by(code: x[:contact])
|
|
||||||
# unless contact
|
|
||||||
# add_epp_error('2303', 'contact', x[:contact], [:domain_contacts, :not_found])
|
|
||||||
# next
|
|
||||||
# end
|
|
||||||
|
|
||||||
unless c
|
unless c
|
||||||
add_epp_error('2303', 'contact', x.text, [:domain_contacts, :not_found])
|
add_epp_error('2303', 'contact', x.text, [:domain_contacts, :not_found])
|
||||||
next
|
next
|
||||||
|
@ -288,7 +290,7 @@ class Epp::EppDomain < Domain
|
||||||
|
|
||||||
frame.css('status').each do |x|
|
frame.css('status').each do |x|
|
||||||
unless DomainStatus::CLIENT_STATUSES.include?(x['s'])
|
unless DomainStatus::CLIENT_STATUSES.include?(x['s'])
|
||||||
add_epp_error('2303', 'status', x[:value], [:domain_statuses, :not_found])
|
add_epp_error('2303', 'status', x['s'], [:domain_statuses, :not_found])
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -323,7 +325,7 @@ class Epp::EppDomain < Domain
|
||||||
at[:dnskeys_attributes] += at_add[:dnskeys_attributes]
|
at[:dnskeys_attributes] += at_add[:dnskeys_attributes]
|
||||||
at[:domain_statuses_attributes] += at_add[:domain_statuses_attributes]
|
at[:domain_statuses_attributes] += at_add[:domain_statuses_attributes]
|
||||||
|
|
||||||
super(at)
|
errors.empty? && super(at)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1248,13 +1248,14 @@ describe 'EPP Domain', epp: true do
|
||||||
rem_cnt.should be_falsey
|
rem_cnt.should be_falsey
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, :xml)
|
||||||
|
|
||||||
response[:results][0][:result_code].should == '2303'
|
response[:results][0][:result_code].should == '2303'
|
||||||
response[:results][0][:msg].should == 'Contact was not found'
|
response[:results][0][:msg].should == 'Nameserver was not found'
|
||||||
response[:results][0][:value].should == 'citizen_1234'
|
response[:results][0][:value].should == 'ns1.example.com'
|
||||||
|
|
||||||
response[:results][1][:result_code].should == '2303'
|
response[:results][1][:result_code].should == '2303'
|
||||||
response[:results][1][:msg].should == 'Nameserver was not found'
|
response[:results][1][:msg].should == 'Contact was not found'
|
||||||
response[:results][1][:value].should == 'ns1.example.com'
|
response[:results][1][:value].should == 'citizen_1234'
|
||||||
|
|
||||||
response[:results][2][:result_code].should == '2303'
|
response[:results][2][:result_code].should == '2303'
|
||||||
response[:results][2][:msg].should == 'Status was not found'
|
response[:results][2][:msg].should == 'Status was not found'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue