Take into account address_processing setting in EPP contact:info

#251
This commit is contained in:
Artur Beljajev 2016-12-14 04:16:04 +02:00
parent 3d6a0936c7
commit a63e2b9dd2
3 changed files with 86 additions and 16 deletions

View file

@ -0,0 +1,57 @@
require 'rails_helper'
RSpec.describe 'EPP contact:update' do
let(:request_xml) { '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<info>
<contact:info xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>test</contact:id>
</contact:info>
</info>
</command>
</epp>'
}
subject(:response_xml) { Nokogiri::XML(response.body) }
subject(:response_code) { response_xml.xpath('//xmlns:result').first['code'] }
subject(:address_count) { response_xml
.xpath('//contact:addr', contact: 'https://epp.tld.ee/schema/contact-ee-1.1.xsd')
.count }
before do
sign_in_to_epp_area
FactoryGirl.create(:contact, code: 'TEST')
end
context 'when address processing is enabled' do
before do
allow(Contact).to receive(:address_processing?).and_return(true)
end
it 'returns epp code of 1000' do
post '/epp/command/info', frame: request_xml
expect(response_code).to eq('1000')
end
it 'returns address' do
post '/epp/command/info', frame: request_xml
expect(address_count).to_not be_zero
end
end
context 'when address processing is disabled' do
before do
allow(Contact).to receive(:address_processing?).and_return(false)
end
it 'returns epp code of 1000' do
post '/epp/command/info', frame: request_xml
expect(response_code).to eq('1000')
end
it 'does not return address' do
post '/epp/command/info', frame: request_xml
expect(address_count).to be_zero
end
end
end