mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
parent
ad1f5e6144
commit
278ae07ac6
28 changed files with 141 additions and 84 deletions
|
@ -1,6 +1,9 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'EPP contact:create' do
|
||||
let(:registrar) { create(:registrar) }
|
||||
let(:user) { create(:api_user_epp, registrar: registrar) }
|
||||
let(:session_id) { create(:epp_session, user: user, registrar: registrar).session_id }
|
||||
let(:request_xml_with_address) { '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
|
@ -36,7 +39,7 @@ RSpec.describe 'EPP contact:create' do
|
|||
subject(:address_saved) { Contact.last.attributes.slice(*Contact.address_attribute_names).compact.any? }
|
||||
|
||||
before do
|
||||
sign_in_to_epp_area
|
||||
login_as user
|
||||
end
|
||||
|
||||
context 'when address processing is enabled' do
|
||||
|
@ -46,17 +49,17 @@ RSpec.describe 'EPP contact:create' do
|
|||
|
||||
context 'with address' do
|
||||
it 'returns epp code of 1000' do
|
||||
post '/epp/command/create', frame: request_xml_with_address
|
||||
post '/epp/command/create', { frame: request_xml_with_address }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(response_code).to eq('1000')
|
||||
end
|
||||
|
||||
it 'returns epp description' do
|
||||
post '/epp/command/create', frame: request_xml_with_address
|
||||
post '/epp/command/create', { frame: request_xml_with_address}, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(response_description).to eq('Command completed successfully')
|
||||
end
|
||||
|
||||
it 'saves address' do
|
||||
post '/epp/command/create', frame: request_xml_with_address
|
||||
post '/epp/command/create', { frame: request_xml_with_address }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(address_saved).to be_truthy
|
||||
end
|
||||
end
|
||||
|
@ -69,17 +72,17 @@ RSpec.describe 'EPP contact:create' do
|
|||
|
||||
context 'with address' do
|
||||
it 'returns epp code of 1100' do
|
||||
post '/epp/command/create', frame: request_xml_with_address
|
||||
post '/epp/command/create', { frame: request_xml_with_address }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(response_code).to eq('1100')
|
||||
end
|
||||
|
||||
it 'returns epp description' do
|
||||
post '/epp/command/create', frame: request_xml_with_address
|
||||
post '/epp/command/create', { frame: request_xml_with_address }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(response_description).to eq('Command completed successfully; Postal address data discarded')
|
||||
end
|
||||
|
||||
it 'does not save address' do
|
||||
post '/epp/command/create', frame: request_xml_with_address
|
||||
post '/epp/command/create', { frame: request_xml_with_address }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(address_saved).to be_falsey
|
||||
end
|
||||
end
|
||||
|
@ -110,12 +113,12 @@ RSpec.describe 'EPP contact:create' do
|
|||
}
|
||||
|
||||
it 'returns epp code of 1000' do
|
||||
post '/epp/command/create', frame: request_xml_without_address
|
||||
post '/epp/command/create', { frame: request_xml_without_address }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(response_code).to eq('1000')
|
||||
end
|
||||
|
||||
it 'returns epp description' do
|
||||
post '/epp/command/create', frame: request_xml_without_address
|
||||
post '/epp/command/create', { frame: request_xml_without_address }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(response_description).to eq('Command completed successfully')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue