diff --git a/spec/epp/epp_helper_spec.rb b/spec/epp/epp_helper_spec.rb index 3d8ec60c2..be33bd160 100644 --- a/spec/epp/epp_helper_spec.rb +++ b/spec/epp/epp_helper_spec.rb @@ -2,149 +2,6 @@ require 'rails_helper' describe 'EPP Helper', epp: true do context 'in context of Domain' do - it 'generates valid login xml' do - expected = Nokogiri::XML(' - - - - gitlab - ghyt9e4fu - - 1.0 - en - - - urn:ietf:params:xml:ns:contact-1.0 - - - ABC-12345 - - - ').to_s.squish - - generated = Nokogiri::XML(login_xml).to_s.squish - expect(generated).to eq(expected) - end - - it 'generates valid create xml' do - expected = Nokogiri::XML(' - - - - - example.ee - 1 - - ns1.example.net - ns2.example.net - - jd1234 - sh8013 - sh8013 - sh801333 - - - - - - 257 - 3 - 5 - AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8 - - - - ABC-12345 - - - ').to_s.squish - - generated = Nokogiri::XML(domain_create_xml).to_s.squish - expect(generated).to eq(expected) - - ### - - expected = Nokogiri::XML(' - - - - - one.ee - 345 - - ns1.test.net - ns2.test.net - - 32fsdaf - 2323rafaf - 3dgxx - 345xxv - - - - - - 257 - 3 - 5 - AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8 - - - - ABC-12345 - - - ').to_s.squish - - xml = domain_create_xml({ - name: { value: 'one.ee' }, - period: { value: '345', attrs: { unit: 'd' } }, - ns: [ - { hostObj: { value: 'ns1.test.net' } }, - { hostObj: { value: 'ns2.test.net' } } - ], - registrant: { value: '32fsdaf' }, - _other: [ - { contact: { value: '2323rafaf', attrs: { type: 'admin' } } }, - { contact: { value: '3dgxx', attrs: { type: 'tech' } } }, - { contact: { value: '345xxv', attrs: { type: 'tech' } } } - ] - }) - - generated = Nokogiri::XML(xml).to_s.squish - expect(generated).to eq(expected) - - ### - - expected = Nokogiri::XML(' - - - - - one.ee - - - ABC-12345 - - - ').to_s.squish - - xml = domain_create_xml({ - name: { value: 'one.ee' }, - period: nil, - ns: nil, - registrant: nil, - _other: nil - }, false) - - generated = Nokogiri::XML(xml).to_s.squish - expect(generated).to eq(expected) - end - it 'generates valid info xml' do expected = Nokogiri::XML(' diff --git a/spec/support/epp.rb b/spec/support/epp.rb index 9f9295b12..9880e3bba 100644 --- a/spec/support/epp.rb +++ b/spec/support/epp.rb @@ -52,92 +52,6 @@ module Epp ### REQUEST TEMPLATES ### - def login_xml(xml_params = {}) - defaults = { - clID: { value: 'gitlab' }, - pw: { value: 'ghyt9e4fu' }, - options: { - version: { value: '1.0' }, - lang: { value: 'en' } - }, - svcs: { - _objURIs: [ - objURI: { value: 'urn:ietf:params:xml:ns:contact-1.0' } - ] - } - } - - xml_params = defaults.deep_merge(xml_params) - - xml = Builder::XmlMarkup.new - - xml.instruct!(:xml, standalone: 'no') - xml.epp( - 'xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', - 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd' - ) do - xml.command do - xml.login do - generate_xml_from_hash(xml_params, xml) - end - xml.clTRID 'ABC-12345' - end - end - end - - def domain_create_xml(xml_params = {}, dnssec_params = {}) - - defaults = { - name: { value: 'example.ee' }, - period: { value: '1', attrs: { unit: 'y' } }, - ns: [ - { hostObj: { value: 'ns1.example.net' } }, - { hostObj: { value: 'ns2.example.net' } } - ], - registrant: { value: 'jd1234' }, - _other: [ - { contact: { value: 'sh8013', attrs: { type: 'admin' } } }, - { contact: { value: 'sh8013', attrs: { type: 'tech' } } }, - { contact: { value: 'sh801333', attrs: { type: 'tech' } } } - ] - } - - xml_params = defaults.deep_merge(xml_params) - - dsnsec_defaults = { - _other: [ - { keyData: { - flags: { value: '257' }, - protocol: { value: '3' }, - alg: { value: '5' }, - pubKey: { value: 'AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8' } - } - }] - } - - dnssec_params = dsnsec_defaults.deep_merge(dnssec_params) if dnssec_params != false - - 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.create do - xml.tag!('domain:create', 'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0') do - generate_xml_from_hash(xml_params, xml, 'domain:') - end - end - xml.extension do - xml.tag!('secDNS:create', 'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1') do - generate_xml_from_hash(dnssec_params, xml, 'secDNS:') - end - end if dnssec_params != false - xml.clTRID 'ABC-12345' - end - end - end - def domain_renew_xml(xml_params = {}) xml = Builder::XmlMarkup.new