mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Merge branch 'master' of github.com:internetee/registry
This commit is contained in:
commit
e317667ffe
5 changed files with 46 additions and 8 deletions
|
@ -9,8 +9,12 @@ xml.epp_head do
|
||||||
xml.tag!('contact:name', @contact.name)
|
xml.tag!('contact:name', @contact.name)
|
||||||
xml.tag!('contact:org', @contact.org_name)
|
xml.tag!('contact:org', @contact.org_name)
|
||||||
xml.tag!('contact:addr') do
|
xml.tag!('contact:addr') do
|
||||||
xml.tag!('contact:street', @contact.address.street)
|
@contact.address do |address|
|
||||||
xml.tag!('contact:street', @contact.address.city)
|
xml.tag!('contact:street', address.street) if address.street
|
||||||
|
xml.tag!('contact:street', address.street2) if address.street2
|
||||||
|
xml.tag!('contact:street', address.street3) if address.street3
|
||||||
|
xml.tag!('contact:cc', address.try(:country).try(:iso)) unless address.try(:country).nil?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
xml.tag!('contact:voice', @contact.phone)
|
xml.tag!('contact:voice', @contact.phone)
|
||||||
xml.tag!('contact:fax', @contact.fax)
|
xml.tag!('contact:fax', @contact.fax)
|
||||||
|
|
|
@ -34,7 +34,7 @@ describe 'EPP Contact', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't check contact if request is invalid" do
|
it "doesn't check contact if request is invalid" do
|
||||||
response = epp_request('contacts/delete_missing_attr.xml')
|
response = epp_request(contact_check_xml( ids: [ false ] ), :xml)
|
||||||
|
|
||||||
expect(response[:results][0][:result_code]).to eq('2003')
|
expect(response[:results][0][:result_code]).to eq('2003')
|
||||||
expect(response[:results][0][:msg]).to eq('Required parameter missing: id')
|
expect(response[:results][0][:msg]).to eq('Required parameter missing: id')
|
||||||
|
@ -123,7 +123,9 @@ describe 'EPP Contact', epp: true do
|
||||||
it 'checks contacts' do
|
it 'checks contacts' do
|
||||||
Fabricate(:contact, code: 'check-1234')
|
Fabricate(:contact, code: 'check-1234')
|
||||||
|
|
||||||
response = epp_request('contacts/check.xml')
|
response = epp_request(contact_check_xml( ids: [{ id: 'check-1234'}, { id: 'check-4321' }] ), :xml)
|
||||||
|
|
||||||
|
#response = epp_request('contacts/check.xml')
|
||||||
expect(response[:result_code]).to eq('1000')
|
expect(response[:result_code]).to eq('1000')
|
||||||
expect(response[:msg]).to eq('Command completed successfully')
|
expect(response[:msg]).to eq('Command completed successfully')
|
||||||
ids = response[:parsed].css('resData chkData id')
|
ids = response[:parsed].css('resData chkData id')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Fabricator(:address) do
|
Fabricator(:address) do
|
||||||
city Faker::Address.city
|
city Faker::Address.city
|
||||||
street Faker::Address.street_name
|
street Faker::Address.street_name
|
||||||
street Faker::Address.street_name
|
street2 Faker::Address.street_name
|
||||||
zip Faker::Address.zip
|
zip Faker::Address.zip
|
||||||
end
|
end
|
||||||
|
|
|
@ -88,6 +88,7 @@ module Epp
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
RSpec.configure do |c|
|
RSpec.configure do |c|
|
||||||
|
|
31
spec/support/epp_contact_xml_builder.rb
Normal file
31
spec/support/epp_contact_xml_builder.rb
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
module EppContactXmlBuilder
|
||||||
|
|
||||||
|
def contact_check_xml(xml_params={})
|
||||||
|
|
||||||
|
xml_params[:ids] = xml_params[:ids] || [ { id: 'check-1234' }, { id: 'check-4321' } ]
|
||||||
|
|
||||||
|
xml = Builder::XmlMarkup.new
|
||||||
|
|
||||||
|
xml.instruct!(:xml, standalone: 'no')
|
||||||
|
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do
|
||||||
|
xml.command do
|
||||||
|
xml.check do
|
||||||
|
xml.tag!('contact:check', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
|
||||||
|
unless xml_params[:ids] == [false]
|
||||||
|
xml_params[:ids].each do |x|
|
||||||
|
xml.tag!('contact:id', x[:id])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
xml.clTRID 'ABC-12345'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
RSpec.configure do |c|
|
||||||
|
c.include EppContactXmlBuilder
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue