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.attach_legal_document(Epp::EppDomain.parse_legal_document_from_frame(params[:parsed_frame]))
|
||||
# binding.pry
|
||||
|
||||
if @domain.update(params[:parsed_frame], current_user)
|
||||
render_epp_response '/epp/domains/success'
|
||||
else
|
||||
|
|
|
@ -68,6 +68,7 @@ class Epp::EppDomain < Domain
|
|||
at = {}.with_indifferent_access
|
||||
|
||||
code = frame.css('registrant').first.try(:text)
|
||||
if code.present?
|
||||
oc = Contact.find_by(code: code).try(:id)
|
||||
|
||||
if oc
|
||||
|
@ -75,6 +76,7 @@ class Epp::EppDomain < Domain
|
|||
else
|
||||
add_epp_error('2303', 'registrant', code, [:owner_contact, :not_found])
|
||||
end
|
||||
end
|
||||
|
||||
at[:name] = frame.css('name').text if new_record?
|
||||
at[:registrar_id] = current_user.registrar.try(:id)
|
||||
|
@ -109,7 +111,7 @@ class Epp::EppDomain < Domain
|
|||
ns_list.each do |ns_attrs|
|
||||
nameserver = nameservers.where(ns_attrs).try(:first)
|
||||
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
|
||||
to_destroy << {
|
||||
id: nameserver.id,
|
||||
|
@ -130,7 +132,13 @@ class Epp::EppDomain < Domain
|
|||
if action == 'rem'
|
||||
to_destroy = []
|
||||
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 << {
|
||||
id: domain_contact_id,
|
||||
_destroy: 1
|
||||
|
@ -148,12 +156,6 @@ class Epp::EppDomain < Domain
|
|||
frame.css('contact').each do |x|
|
||||
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
|
||||
add_epp_error('2303', 'contact', x.text, [:domain_contacts, :not_found])
|
||||
next
|
||||
|
@ -288,7 +290,7 @@ class Epp::EppDomain < Domain
|
|||
|
||||
frame.css('status').each do |x|
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -323,7 +325,7 @@ class Epp::EppDomain < Domain
|
|||
at[:dnskeys_attributes] += at_add[:dnskeys_attributes]
|
||||
at[:domain_statuses_attributes] += at_add[:domain_statuses_attributes]
|
||||
|
||||
super(at)
|
||||
errors.empty? && super(at)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -1248,13 +1248,14 @@ describe 'EPP Domain', epp: true do
|
|||
rem_cnt.should be_falsey
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
|
||||
response[:results][0][:result_code].should == '2303'
|
||||
response[:results][0][:msg].should == 'Contact was not found'
|
||||
response[:results][0][:value].should == 'citizen_1234'
|
||||
response[:results][0][:msg].should == 'Nameserver was not found'
|
||||
response[:results][0][:value].should == 'ns1.example.com'
|
||||
|
||||
response[:results][1][:result_code].should == '2303'
|
||||
response[:results][1][:msg].should == 'Nameserver was not found'
|
||||
response[:results][1][:value].should == 'ns1.example.com'
|
||||
response[:results][1][:msg].should == 'Contact was not found'
|
||||
response[:results][1][:value].should == 'citizen_1234'
|
||||
|
||||
response[:results][2][:result_code].should == '2303'
|
||||
response[:results][2][:msg].should == 'Status was not found'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue