From 5cdab8faa755299ebc36c4a1bdb3dd1fecacd537 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Fri, 24 Oct 2014 17:14:15 +0300 Subject: [PATCH] Update epp-xml gem --- Gemfile | 2 +- Gemfile.lock | 4 ++-- spec/epp/domain_spec.rb | 49 +++++++++++++++++++++++++---------------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/Gemfile b/Gemfile index 194ba7fea..11ada97ca 100644 --- a/Gemfile +++ b/Gemfile @@ -85,7 +85,7 @@ group :development, :test do gem 'epp', '~> 1.4.0' # EPP XMLs - gem 'epp-xml' + gem 'epp-xml', '~> 0.1.0' # Replacement for fixtures gem 'fabrication', '~> 2.11.3' diff --git a/Gemfile.lock b/Gemfile.lock index 434305c5f..75bfcd682 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -93,7 +93,7 @@ GEM epp (1.4.0) hpricot libxml-ruby - epp-xml (0.0.2) + epp-xml (0.1.0) activesupport (~> 4.1) builder (~> 3.2) equalizer (0.0.9) @@ -362,7 +362,7 @@ DEPENDENCIES database_cleaner (~> 1.3.0) devise (~> 3.3.0) epp (~> 1.4.0) - epp-xml + epp-xml (~> 0.1.0) fabrication (~> 2.11.3) faker (~> 1.3.0) guard (~> 2.6.1) diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 68fb579f0..67e6a16b9 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -217,7 +217,7 @@ describe 'EPP Domain', epp: true do xml = EppXml::Domain.create({ name: { value: 'ria.ee' } }, { - _other: [ + _anonymus: [ { keyData: { flags: { value: '257' }, protocol: { value: '3' }, @@ -352,7 +352,7 @@ describe 'EPP Domain', epp: true do it 'creates a domain with multiple dnskeys' do xml = EppXml::Domain.create({}, { - _other: [ + _anonymus: [ { keyData: { flags: { value: '257' }, protocol: { value: '3' }, @@ -402,7 +402,7 @@ describe 'EPP Domain', epp: true do it 'does not create a domain when dnskeys are invalid' do xml = EppXml::Domain.create({}, { - _other: [ + _anonymus: [ { keyData: { flags: { value: '250' }, protocol: { value: '4' }, @@ -454,7 +454,7 @@ describe 'EPP Domain', epp: true do it 'does not create a domain with two identical dnskeys' do xml = EppXml::Domain.create({}, { - _other: [ + _anonymus: [ { keyData: { flags: { value: '257' }, protocol: { value: '3' }, @@ -483,7 +483,7 @@ describe 'EPP Domain', epp: true do Setting.dnskeys_max_count = 1 xml = EppXml::Domain.create({}, { - _other: [ + _anonymus: [ { keyData: { flags: { value: '257' }, protocol: { value: '3' }, @@ -509,7 +509,7 @@ describe 'EPP Domain', epp: true do it 'creates domain with ds data' do xml = EppXml::Domain.create({}, { - _other: [ + _anonymus: [ { dsData: { keyTag: { value: '12345' }, alg: { value: '3' }, @@ -535,7 +535,7 @@ describe 'EPP Domain', epp: true do it 'creates domain with ds data with key' do xml = EppXml::Domain.create({}, { - _other: [ + _anonymus: [ { dsData: { keyTag: { value: '12345' }, alg: { value: '3' }, @@ -569,7 +569,7 @@ describe 'EPP Domain', epp: true do Setting.ds_data_with_key_allowed = false xml = EppXml::Domain.create({}, { - _other: [ + _anonymus: [ { dsData: { keyTag: { value: '12345' }, alg: { value: '3' }, @@ -594,7 +594,7 @@ describe 'EPP Domain', epp: true do Setting.ds_data_allowed = false xml = EppXml::Domain.create({}, { - _other: [ + _anonymus: [ { dsData: { keyTag: { value: '12345' }, alg: { value: '3' }, @@ -619,7 +619,7 @@ describe 'EPP Domain', epp: true do Setting.key_data_allowed = false xml = EppXml::Domain.create({}, { - _other: [ + _anonymus: [ keyData: { flags: { value: '0' }, protocol: { value: '3' }, @@ -643,7 +643,7 @@ describe 'EPP Domain', epp: true do it 'creates a domain with contacts' do xml = EppXml::Domain.create({ - _other: [ + _anonymus: [ { contact: { value: 'sh8013', attrs: { type: 'admin' } } } ] }) @@ -662,7 +662,7 @@ describe 'EPP Domain', epp: true do it 'does not create a domain without admin contact' do xml = EppXml::Domain.create({ - _other: [ + _anonymus: [ { contact: { value: 'sh8013', attrs: { type: 'tech' } } } ] }) @@ -818,7 +818,7 @@ describe 'EPP Domain', epp: true do { hostObj: { value: 'ns2.example.com' } } ] }, - _other: [ + _anonymus: [ { contact: { value: 'mak21', attrs: { type: 'tech' } } }, { status: { value: 'Payment overdue.', attrs: { s: 'clientHold', lang: 'en' } } }, { status: { value: '', attrs: { s: 'clientUpdateProhibited' } } } @@ -901,7 +901,7 @@ describe 'EPP Domain', epp: true do { hostObj: { value: 'ns2.example.com' } } ] }, - _other: [ + _anonymus: [ { contact: { value: 'mak21', attrs: { type: 'tech' } } }, { status: { value: 'Payment overdue.', attrs: { s: 'clientHold', lang: 'en' } } }, { status: { value: '', attrs: { s: 'clientUpdateProhibited' } } } @@ -938,7 +938,7 @@ describe 'EPP Domain', epp: true do { hostObj: { value: 'ns1.example.com' } } ] }, - _other: [ + _anonymus: [ { contact: { value: 'mak21', attrs: { type: 'tech' } } }, { status: { value: '', attrs: { s: 'clientHold' } } } ] @@ -1049,7 +1049,7 @@ describe 'EPP Domain', epp: true do end it 'checks a domain' do - response = epp_request(domain_check_xml, :xml) + response = epp_request(EppXml::Domain.check, :xml) expect(response[:result_code]).to eq('1000') expect(response[:msg]).to eq('Command completed successfully') @@ -1059,7 +1059,7 @@ describe 'EPP Domain', epp: true do Fabricate(:domain, name: 'example.ee', registrar: zone) - response = epp_request(domain_check_xml, :xml) + response = epp_request(EppXml::Domain.check, :xml) domain = response[:parsed].css('resData chkData cd').first name = domain.css('name').first reason = domain.css('reason').first @@ -1070,7 +1070,13 @@ describe 'EPP Domain', epp: true do end it 'checks multiple domains' do - xml = domain_check_xml(names: ['one.ee', 'two.ee', 'three.ee']) + xml = EppXml::Domain.check({ + _anonymus: [ + { name: { value: 'one.ee' } }, + { name: { value: 'two.ee' } }, + { name: { value: 'three.ee' } } + ] + }) response = epp_request(xml, :xml) expect(response[:result_code]).to eq('1000') @@ -1086,7 +1092,12 @@ describe 'EPP Domain', epp: true do end it 'checks invalid format domain' do - xml = domain_check_xml(names: ['one.ee', 'notcorrectdomain']) + xml = EppXml::Domain.check({ + _anonymus: [ + { name: { value: 'one.ee' } }, + { name: { value: 'notcorrectdomain' } } + ] + }) response = epp_request(xml, :xml) expect(response[:result_code]).to eq('1000')