mirror of
https://github.com/internetee/registry.git
synced 2025-08-17 15:03:59 +02:00
commit
1bdc44ea91
4 changed files with 206 additions and 7 deletions
|
@ -31,10 +31,9 @@ RSpec.configure do |config|
|
||||||
config.include ActiveSupport::Testing::TimeHelpers
|
config.include ActiveSupport::Testing::TimeHelpers
|
||||||
config.include Requests::SessionHelpers, type: :request
|
config.include Requests::SessionHelpers, type: :request
|
||||||
config.include Features::SessionHelpers, type: :feature
|
config.include Features::SessionHelpers, type: :feature
|
||||||
|
config.include AbstractController::Translation, type: :request
|
||||||
config.include AbstractController::Translation, type: :feature
|
config.include AbstractController::Translation, type: :feature
|
||||||
config.include Requests::EPPHelpers, epp: true
|
config.include Requests::EPPHelpers, type: :request
|
||||||
|
|
||||||
config.include Requests::EPPHelpers, epp: true
|
|
||||||
|
|
||||||
config.define_derived_metadata(file_path: %r[/spec/features/]) do |metadata|
|
config.define_derived_metadata(file_path: %r[/spec/features/]) do |metadata|
|
||||||
metadata[:db] = true if metadata[:db].nil?
|
metadata[:db] = true if metadata[:db].nil?
|
||||||
|
@ -60,10 +59,6 @@ RSpec.configure do |config|
|
||||||
metadata[:type] = :request
|
metadata[:type] = :request
|
||||||
end
|
end
|
||||||
|
|
||||||
config.define_derived_metadata(file_path: %r[/spec/requests/epp/]) do |metadata|
|
|
||||||
metadata[:epp] = true if metadata[:epp].nil?
|
|
||||||
end
|
|
||||||
|
|
||||||
config.use_transactional_fixtures = false
|
config.use_transactional_fixtures = false
|
||||||
config.infer_spec_type_from_file_location!
|
config.infer_spec_type_from_file_location!
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe 'EPP domain:update' do
|
||||||
|
let(:request) { post '/epp/command/update', frame: request_xml }
|
||||||
|
let!(:registrant) { create(:registrant, code: 'old-code') }
|
||||||
|
let!(:domain) { create(:domain, name: 'test.com', registrant: registrant) }
|
||||||
|
let!(:new_registrant) { create(:registrant, code: 'new-code') }
|
||||||
|
|
||||||
|
before :example do
|
||||||
|
sign_in_to_epp_area
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when registrant change confirmation is enabled' do
|
||||||
|
before :example do
|
||||||
|
Setting.request_confrimation_on_registrant_change_enabled = true
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when verified' do
|
||||||
|
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">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>test.com</domain:name>
|
||||||
|
<domain:chg>
|
||||||
|
<domain:registrant verified="yes">new-code</domain:registrant>
|
||||||
|
</domain:chg>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<extension>
|
||||||
|
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||||
|
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||||
|
</eis:extdata>
|
||||||
|
</extension>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
}
|
||||||
|
|
||||||
|
specify do
|
||||||
|
request
|
||||||
|
expect(response).to have_code_of(1000)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'changes registrant' do
|
||||||
|
expect { request; domain.reload }.to change { domain.registrant_code }.from('old-code').to('new-code')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not send confirmation email' do
|
||||||
|
expect { request }.to_not change { ActionMailer::Base.deliveries.count }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not set PENDING_UPDATE status to domain' do
|
||||||
|
request
|
||||||
|
domain.reload
|
||||||
|
expect(domain.statuses).to_not include(DomainStatus::PENDING_UPDATE)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when not verified' do
|
||||||
|
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">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>test.com</domain:name>
|
||||||
|
<domain:chg>
|
||||||
|
<domain:registrant verified="no">new-code</domain:registrant>
|
||||||
|
</domain:chg>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<extension>
|
||||||
|
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||||
|
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||||
|
</eis:extdata>
|
||||||
|
</extension>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
}
|
||||||
|
|
||||||
|
specify do
|
||||||
|
request
|
||||||
|
expect(response).to have_code_of(1001)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not change registrant' do
|
||||||
|
expect { request; domain.reload }.to_not change { domain.registrant_code }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sends confirmation and notice emails' do
|
||||||
|
expect { request }.to change { ActionMailer::Base.deliveries.count }.by(2)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sets PENDING_UPDATE status to domain' do
|
||||||
|
request
|
||||||
|
domain.reload
|
||||||
|
expect(domain.statuses).to include(DomainStatus::PENDING_UPDATE)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when registrant change confirmation is disabled' do
|
||||||
|
before :example do
|
||||||
|
Setting.request_confrimation_on_registrant_change_enabled = false
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when verified' do
|
||||||
|
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">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>test.com</domain:name>
|
||||||
|
<domain:chg>
|
||||||
|
<domain:registrant verified="yes">new-code</domain:registrant>
|
||||||
|
</domain:chg>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<extension>
|
||||||
|
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||||
|
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||||
|
</eis:extdata>
|
||||||
|
</extension>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
}
|
||||||
|
|
||||||
|
specify do
|
||||||
|
request
|
||||||
|
expect(response).to have_code_of(1000)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'changes registrant' do
|
||||||
|
expect { request; domain.reload }.to change { domain.registrant_code }.from('old-code').to('new-code')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not send confirmation email' do
|
||||||
|
expect { request }.to_not change { ActionMailer::Base.deliveries.count }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not set PENDING_UPDATE status to domain' do
|
||||||
|
request
|
||||||
|
domain.reload
|
||||||
|
expect(domain.statuses).to_not include(DomainStatus::PENDING_UPDATE)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when not verified' do
|
||||||
|
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">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>test.com</domain:name>
|
||||||
|
<domain:chg>
|
||||||
|
<domain:registrant verified="no">new-code</domain:registrant>
|
||||||
|
</domain:chg>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<extension>
|
||||||
|
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||||
|
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||||
|
</eis:extdata>
|
||||||
|
</extension>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
}
|
||||||
|
|
||||||
|
specify do
|
||||||
|
request
|
||||||
|
expect(response).to have_code_of(1000)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'changes registrant' do
|
||||||
|
expect { request; domain.reload }.to change { domain.registrant_code }.from('old-code').to('new-code')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not send confirmation email' do
|
||||||
|
expect { request }.to_not change { ActionMailer::Base.deliveries.count }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not set PENDING_UPDATE status to domain' do
|
||||||
|
request
|
||||||
|
domain.reload
|
||||||
|
expect(domain.statuses).to_not include(DomainStatus::PENDING_UPDATE)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,5 +3,9 @@ module Requests
|
||||||
def have_code_of(*args)
|
def have_code_of(*args)
|
||||||
Matchers::EPP::Code.new(*args)
|
Matchers::EPP::Code.new(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def valid_legal_document
|
||||||
|
Base64.encode64('a' * 5000)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -28,5 +28,9 @@ module Requests
|
||||||
|
|
||||||
post '/epp/session/login', frame: login_xml
|
post '/epp/session/login', frame: login_xml
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sign_in_to_admin_area(user: FactoryGirl.create(:admin_user))
|
||||||
|
post admin_sessions_path, admin_user: { username: user.username, password: user.password }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue