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
|
has_many :keyrelays
|
||||||
|
|
||||||
accepts_nested_attributes_for :dnskeys, allow_destroy: true,
|
accepts_nested_attributes_for :dnskeys, allow_destroy: true
|
||||||
reject_if: proc { |attrs| attrs[:public_key].blank? }
|
|
||||||
|
|
||||||
has_many :legal_documents, as: :documentable
|
has_many :legal_documents, as: :documentable
|
||||||
accepts_nested_attributes_for :legal_documents, reject_if: proc { |attrs| attrs[:body].blank? }
|
accepts_nested_attributes_for :legal_documents, reject_if: proc { |attrs| attrs[:body].blank? }
|
||||||
|
@ -68,10 +67,10 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
validate :validate_period
|
validate :validate_period
|
||||||
|
|
||||||
# validates :nameservers, object_count: {
|
validates :nameservers, object_count: {
|
||||||
# min: -> { Setting.ns_min_count },
|
min: -> { Setting.ns_min_count },
|
||||||
# max: -> { Setting.ns_max_count }
|
max: -> { Setting.ns_max_count }
|
||||||
# }
|
}
|
||||||
|
|
||||||
validates :dnskeys, object_count: {
|
validates :dnskeys, object_count: {
|
||||||
min: -> { Setting.dnskeys_min_count },
|
min: -> { Setting.dnskeys_min_count },
|
||||||
|
@ -90,9 +89,9 @@ class Domain < ActiveRecord::Base
|
||||||
max: -> { Setting.tech_contacts_max_count }
|
max: -> { Setting.tech_contacts_max_count }
|
||||||
}
|
}
|
||||||
|
|
||||||
# validates :nameservers, uniqueness_multi: {
|
validates :nameservers, uniqueness_multi: {
|
||||||
# attribute: 'hostname'
|
attribute: 'hostname'
|
||||||
# }
|
}
|
||||||
|
|
||||||
validates :tech_domain_contacts, uniqueness_multi: {
|
validates :tech_domain_contacts, uniqueness_multi: {
|
||||||
association: 'domain_contacts',
|
association: 'domain_contacts',
|
||||||
|
@ -112,7 +111,7 @@ class Domain < ActiveRecord::Base
|
||||||
attribute: 'public_key'
|
attribute: 'public_key'
|
||||||
}
|
}
|
||||||
|
|
||||||
# validate :validate_nameserver_ips
|
validate :validate_nameserver_ips
|
||||||
|
|
||||||
attr_accessor :owner_contact_typeahead, :update_me
|
attr_accessor :owner_contact_typeahead, :update_me
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,14 @@ class Epp::EppDomain < Domain
|
||||||
at[:nameservers_attributes] = nameservers_attrs(frame, action)
|
at[:nameservers_attributes] = nameservers_attrs(frame, action)
|
||||||
at[:domain_contacts_attributes] = domain_contacts_attrs(frame, action)
|
at[:domain_contacts_attributes] = domain_contacts_attrs(frame, action)
|
||||||
at[:domain_statuses_attributes] = domain_statuses_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[:legal_documents_attributes] = legal_document_from(frame)
|
||||||
|
|
||||||
at
|
at
|
||||||
|
@ -141,8 +148,19 @@ class Epp::EppDomain < Domain
|
||||||
frame.css('contact').each do |x|
|
frame.css('contact').each do |x|
|
||||||
c = Contact.find_by(code: x.text).try(:id)
|
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
|
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
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -59,19 +59,19 @@ describe 'EPP Domain', epp: true do
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, :xml)
|
||||||
response[:results][0][:result_code].should == '2003'
|
response[:results][0][:result_code].should == '2003'
|
||||||
response[:results][0][:msg].should ==
|
response[:results][0][:msg].should ==
|
||||||
'Required parameter missing: create > create > ns [ns]'
|
'Required parameter missing: create > create > ns [ns]'
|
||||||
|
|
||||||
response[:results][1][:result_code].should == '2003'
|
response[:results][1][:result_code].should == '2003'
|
||||||
response[:results][1][:msg].should ==
|
response[:results][1][:msg].should ==
|
||||||
'Required parameter missing: create > create > registrant [registrant]'
|
'Required parameter missing: create > create > registrant [registrant]'
|
||||||
|
|
||||||
response[:results][2][:result_code].should == '2003'
|
response[:results][2][:result_code].should == '2003'
|
||||||
response[:results][2][:msg].should ==
|
response[:results][2][:msg].should ==
|
||||||
'Required parameter missing: create > create > ns > hostAttr [host_attr]'
|
'Required parameter missing: create > create > ns > hostAttr [host_attr]'
|
||||||
|
|
||||||
response[:results][3][:result_code].should == '2003'
|
response[:results][3][:result_code].should == '2003'
|
||||||
response[:results][3][:msg].should ==
|
response[:results][3][:msg].should ==
|
||||||
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -170,6 +170,7 @@ describe 'EPP Domain', epp: true do
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, :xml)
|
||||||
|
|
||||||
response[:result_code].should == '2306'
|
response[:result_code].should == '2306'
|
||||||
response[:msg].should == 'IPv4 is missing [ipv4]'
|
response[:msg].should == 'IPv4 is missing [ipv4]'
|
||||||
end
|
end
|
||||||
|
@ -202,7 +203,7 @@ describe 'EPP Domain', epp: true do
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, :xml)
|
||||||
response[:results][0][:result_code].should == '2003'
|
response[:results][0][:result_code].should == '2003'
|
||||||
response[:results][0][:msg].should ==
|
response[:results][0][:msg].should ==
|
||||||
'Required parameter missing: create > create > registrant [registrant]'
|
'Required parameter missing: create > create > registrant [registrant]'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -210,11 +211,11 @@ describe 'EPP Domain', epp: true do
|
||||||
xml = domain_create_xml(ns: [])
|
xml = domain_create_xml(ns: [])
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, :xml)
|
||||||
|
|
||||||
response[:results][0][:msg].should ==
|
response[:results][0][:msg].should ==
|
||||||
'Required parameter missing: create > create > ns [ns]'
|
'Required parameter missing: create > create > ns [ns]'
|
||||||
response[:results][0][:result_code].should == '2003'
|
response[:results][0][:result_code].should == '2003'
|
||||||
|
|
||||||
response[:results][1][:msg].should ==
|
response[:results][1][:msg].should ==
|
||||||
'Required parameter missing: create > create > ns > hostAttr [host_attr]'
|
'Required parameter missing: create > create > ns > hostAttr [host_attr]'
|
||||||
response[:results][1][:result_code].should == '2003'
|
response[:results][1][:result_code].should == '2003'
|
||||||
|
|
||||||
|
@ -402,7 +403,7 @@ describe 'EPP Domain', epp: true do
|
||||||
|
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, :xml)
|
||||||
|
|
||||||
response[:results][0][:msg].should ==
|
response[:results][0][:msg].should ==
|
||||||
'Valid algorithms are: 3, 5, 6, 7, 8, 252, 253, 254, 255 [alg]'
|
'Valid algorithms are: 3, 5, 6, 7, 8, 252, 253, 254, 255 [alg]'
|
||||||
response[:results][0][:value].should == '9'
|
response[:results][0][:value].should == '9'
|
||||||
|
|
||||||
|
@ -865,7 +866,7 @@ describe 'EPP Domain', epp: true do
|
||||||
login_as :registrar2 do
|
login_as :registrar2 do
|
||||||
response = epp_plain_request(xml, :xml)
|
response = epp_plain_request(xml, :xml)
|
||||||
response[:result_code].should == '2003'
|
response[:result_code].should == '2003'
|
||||||
response[:msg].should ==
|
response[:msg].should ==
|
||||||
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1322,7 +1323,7 @@ describe 'EPP Domain', epp: true do
|
||||||
}
|
}
|
||||||
|
|
||||||
response = epp_plain_request(domain_update_xml(xml_params), :xml)
|
response = epp_plain_request(domain_update_xml(xml_params), :xml)
|
||||||
response[:results][0][:msg].should ==
|
response[:results][0][:msg].should ==
|
||||||
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
||||||
response[:results][0][:result_code].should == '2003'
|
response[:results][0][:result_code].should == '2003'
|
||||||
end
|
end
|
||||||
|
@ -1532,7 +1533,7 @@ describe 'EPP Domain', epp: true do
|
||||||
it 'does not delete domain without legal document' do
|
it 'does not delete domain without legal document' do
|
||||||
response = epp_plain_request(@epp_xml.domain.delete(name: { value: 'example.ee' }), :xml)
|
response = epp_plain_request(@epp_xml.domain.delete(name: { value: 'example.ee' }), :xml)
|
||||||
response[:result_code].should == '2003'
|
response[:result_code].should == '2003'
|
||||||
response[:msg].should ==
|
response[:msg].should ==
|
||||||
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue