mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 09:45:11 +02:00
parent
ad1f5e6144
commit
278ae07ac6
28 changed files with 141 additions and 84 deletions
|
@ -1,11 +1,14 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'EPP contact:create' do
|
||||
let(:request) { post '/epp/command/create', frame: request_xml }
|
||||
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) { post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}" }
|
||||
|
||||
before do
|
||||
Setting.address_processing = false
|
||||
sign_in_to_epp_area
|
||||
login_as user
|
||||
end
|
||||
|
||||
context 'when all ident params are valid' do
|
||||
|
|
|
@ -2,7 +2,10 @@ require 'rails_helper'
|
|||
require_relative '../shared/phone'
|
||||
|
||||
RSpec.describe 'EPP contact:create' do
|
||||
let(:request) { post '/epp/command/create', frame: request_xml }
|
||||
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) { post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}" }
|
||||
let(:request_xml) { <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
|
@ -27,7 +30,7 @@ RSpec.describe 'EPP contact:create' do
|
|||
}
|
||||
|
||||
before do
|
||||
sign_in_to_epp_area
|
||||
login_as user
|
||||
allow(Contact).to receive(:address_processing?).and_return(false)
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'EPP contact:delete' do
|
||||
let(:session_id) { create(:epp_session, user: user, registrar: registrar).session_id }
|
||||
let(:user) { create(:api_user, registrar: registrar) }
|
||||
let(:registrar) { create(:registrar) }
|
||||
let!(:registrant) { create(:registrant, registrar: registrar, code: 'TEST') }
|
||||
let(:request) { post '/epp/command/delete', frame: request_xml }
|
||||
let(:request) { post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}" }
|
||||
let(:request_xml) { <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
|
@ -20,7 +21,7 @@ RSpec.describe 'EPP contact:delete' do
|
|||
}
|
||||
|
||||
before do
|
||||
sign_in_to_epp_area(user: user)
|
||||
login_as user
|
||||
end
|
||||
|
||||
context 'when contact is used' do
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'EPP contact:update' 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) { '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
|
@ -19,7 +22,7 @@ RSpec.describe 'EPP contact:update' do
|
|||
.count }
|
||||
|
||||
before do
|
||||
sign_in_to_epp_area
|
||||
login_as user
|
||||
create(:contact, code: 'TEST')
|
||||
end
|
||||
|
||||
|
@ -29,12 +32,12 @@ RSpec.describe 'EPP contact:update' do
|
|||
end
|
||||
|
||||
it 'returns epp code of 1000' do
|
||||
post '/epp/command/info', frame: request_xml
|
||||
post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(response_code).to eq('1000')
|
||||
end
|
||||
|
||||
it 'returns address' do
|
||||
post '/epp/command/info', frame: request_xml
|
||||
post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(address_count).to_not be_zero
|
||||
end
|
||||
end
|
||||
|
@ -45,12 +48,12 @@ RSpec.describe 'EPP contact:update' do
|
|||
end
|
||||
|
||||
it 'returns epp code of 1000' do
|
||||
post '/epp/command/info', frame: request_xml
|
||||
post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(response_code).to eq('1000')
|
||||
end
|
||||
|
||||
it 'does not return address' do
|
||||
post '/epp/command/info', frame: request_xml
|
||||
post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(address_count).to be_zero
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,8 +3,11 @@ require 'rails_helper'
|
|||
# https://github.com/internetee/registry/issues/576
|
||||
|
||||
RSpec.describe 'EPP contact:update' 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(:ident) { contact.identifier }
|
||||
let(:request) { post '/epp/command/update', frame: request_xml }
|
||||
let(:request) { post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}" }
|
||||
let(:request_xml) { <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
|
@ -30,7 +33,7 @@ RSpec.describe 'EPP contact:update' do
|
|||
}
|
||||
|
||||
before do
|
||||
sign_in_to_epp_area
|
||||
login_as user
|
||||
end
|
||||
|
||||
context 'when contact ident is valid' do
|
||||
|
|
|
@ -2,8 +2,11 @@ require 'rails_helper'
|
|||
require_relative '../shared/phone'
|
||||
|
||||
RSpec.describe 'EPP contact:update' 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!(:contact) { create(:contact, code: 'TEST') }
|
||||
let(:request) { post '/epp/command/update', frame: request_xml }
|
||||
let(:request) { post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}" }
|
||||
let(:request_xml) { <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
|
@ -22,7 +25,7 @@ RSpec.describe 'EPP contact:update' do
|
|||
}
|
||||
|
||||
before do
|
||||
sign_in_to_epp_area
|
||||
login_as user
|
||||
allow(Contact).to receive(:address_processing?).and_return(false)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'EPP contact:update' 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>
|
||||
|
@ -33,7 +36,7 @@ RSpec.describe 'EPP contact:update' do
|
|||
subject(:response_description) { response_xml.css('result msg').text }
|
||||
|
||||
before do
|
||||
sign_in_to_epp_area
|
||||
login_as user
|
||||
create(:contact, code: 'TEST')
|
||||
end
|
||||
|
||||
|
@ -44,12 +47,12 @@ RSpec.describe 'EPP contact:update' do
|
|||
|
||||
context 'with address' do
|
||||
it 'returns epp code of 1000' do
|
||||
post '/epp/command/update', frame: request_xml_with_address
|
||||
post '/epp/command/update', { 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/update', frame: request_xml_with_address
|
||||
post '/epp/command/update', { frame: request_xml_with_address }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(response_description).to eq('Command completed successfully')
|
||||
end
|
||||
end
|
||||
|
@ -62,12 +65,12 @@ RSpec.describe 'EPP contact:update' do
|
|||
|
||||
context 'with address' do
|
||||
it 'returns epp code of 1100' do
|
||||
post '/epp/command/update', frame: request_xml_with_address
|
||||
post '/epp/command/update', { 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/update', frame: request_xml_with_address
|
||||
post '/epp/command/update', { frame: request_xml_with_address }, 'HTTP_COOKIE' => "session=#{session_id}"
|
||||
expect(response_description).to eq('Command completed successfully; Postal address data discarded')
|
||||
end
|
||||
end
|
||||
|
@ -92,12 +95,12 @@ RSpec.describe 'EPP contact:update' do
|
|||
}
|
||||
|
||||
it 'returns epp code of 1000' do
|
||||
post '/epp/command/update', frame: request_xml_without_address
|
||||
post '/epp/command/update', { 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/update', frame: request_xml_without_address
|
||||
post '/epp/command/update', { 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