mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
Test fixes
This commit is contained in:
parent
7017c34297
commit
b4545bae08
3 changed files with 41 additions and 23 deletions
|
@ -35,8 +35,7 @@ class Domain < ActiveRecord::Base
|
|||
|
||||
has_many :keyrelays
|
||||
|
||||
accepts_nested_attributes_for :dnskeys, allow_destroy: true,
|
||||
reject_if: proc { |attrs| attrs[:public_key].blank? }
|
||||
accepts_nested_attributes_for :dnskeys, allow_destroy: true
|
||||
|
||||
has_many :legal_documents, as: :documentable
|
||||
accepts_nested_attributes_for :legal_documents, reject_if: proc { |attrs| attrs[:body].blank? }
|
||||
|
@ -68,10 +67,10 @@ class Domain < ActiveRecord::Base
|
|||
|
||||
validate :validate_period
|
||||
|
||||
# validates :nameservers, object_count: {
|
||||
# min: -> { Setting.ns_min_count },
|
||||
# max: -> { Setting.ns_max_count }
|
||||
# }
|
||||
validates :nameservers, object_count: {
|
||||
min: -> { Setting.ns_min_count },
|
||||
max: -> { Setting.ns_max_count }
|
||||
}
|
||||
|
||||
validates :dnskeys, object_count: {
|
||||
min: -> { Setting.dnskeys_min_count },
|
||||
|
@ -90,9 +89,9 @@ class Domain < ActiveRecord::Base
|
|||
max: -> { Setting.tech_contacts_max_count }
|
||||
}
|
||||
|
||||
# validates :nameservers, uniqueness_multi: {
|
||||
# attribute: 'hostname'
|
||||
# }
|
||||
validates :nameservers, uniqueness_multi: {
|
||||
attribute: 'hostname'
|
||||
}
|
||||
|
||||
validates :tech_domain_contacts, uniqueness_multi: {
|
||||
association: 'domain_contacts',
|
||||
|
@ -112,7 +111,7 @@ class Domain < ActiveRecord::Base
|
|||
attribute: 'public_key'
|
||||
}
|
||||
|
||||
# validate :validate_nameserver_ips
|
||||
validate :validate_nameserver_ips
|
||||
|
||||
attr_accessor :owner_contact_typeahead, :update_me
|
||||
|
||||
|
|
|
@ -88,7 +88,14 @@ class Epp::EppDomain < Domain
|
|||
at[:nameservers_attributes] = nameservers_attrs(frame, action)
|
||||
at[:domain_contacts_attributes] = domain_contacts_attrs(frame, action)
|
||||
at[:domain_statuses_attributes] = domain_statuses_attrs(frame, action)
|
||||
at[:dnskeys_attributes] = dnskeys_attrs(frame, action)
|
||||
|
||||
if new_record?
|
||||
dnskey_frame = frame.css('extension create')
|
||||
else
|
||||
dnskey_frame = frame
|
||||
end
|
||||
|
||||
at[:dnskeys_attributes] = dnskeys_attrs(dnskey_frame, action)
|
||||
at[:legal_documents_attributes] = legal_document_from(frame)
|
||||
|
||||
at
|
||||
|
@ -141,8 +148,19 @@ class Epp::EppDomain < Domain
|
|||
frame.css('contact').each do |x|
|
||||
c = Contact.find_by(code: x.text).try(:id)
|
||||
|
||||
# contact = Contact.find_by(code: x[:contact])
|
||||
# unless contact
|
||||
# add_epp_error('2303', 'contact', x[:contact], [:domain_contacts, :not_found])
|
||||
# next
|
||||
# end
|
||||
|
||||
# if k == :admin && contact.bic?
|
||||
# add_epp_error('2306', 'contact', x[:contact], [:domain_contacts, :admin_contact_can_be_only_citizen])
|
||||
# next
|
||||
# end
|
||||
|
||||
unless c
|
||||
add_epp_error('2303', 'contact', x.text, msg: I18n.t('contact_not_found'))
|
||||
add_epp_error('2303', 'contact', x.text, [:domain_contacts, :not_found])
|
||||
next
|
||||
end
|
||||
|
||||
|
|
|
@ -170,6 +170,7 @@ describe 'EPP Domain', epp: true do
|
|||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
|
||||
response[:result_code].should == '2306'
|
||||
response[:msg].should == 'IPv4 is missing [ipv4]'
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue