mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +02:00
Refactored contact_check specs onto xml builder
This commit is contained in:
parent
c4e577f437
commit
ca7779fb4c
2 changed files with 31 additions and 2 deletions
|
@ -34,7 +34,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
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][:msg]).to eq('Required parameter missing: id')
|
||||
|
@ -123,7 +123,9 @@ describe 'EPP Contact', epp: true do
|
|||
it 'checks contacts' do
|
||||
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[:msg]).to eq('Command completed successfully')
|
||||
ids = response[:parsed].css('resData chkData id')
|
||||
|
|
|
@ -88,6 +88,33 @@ module Epp
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
#contact builders
|
||||
|
||||
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|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue