mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
parent
3d6a0936c7
commit
a63e2b9dd2
3 changed files with 86 additions and 16 deletions
57
spec/requests/epp/contact/info_spec.rb
Normal file
57
spec/requests/epp/contact/info_spec.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue