mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 01:33:36 +02:00
Registrant change now requires EPP verify attribute
This commit is contained in:
parent
7d0365974e
commit
d72cbc20f5
21 changed files with 318 additions and 29 deletions
|
@ -1379,7 +1379,7 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
d.registrant_code.should == 'FIXED:CITIZEN_1234'
|
||||
d.auth_info.should == existing_pw
|
||||
d.update_pending?.should == false
|
||||
d.pending_update?.should == false
|
||||
end
|
||||
|
||||
it 'updates a domain' do
|
||||
|
@ -1406,12 +1406,12 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
d = Domain.last
|
||||
|
||||
d.registrant_code.should == 'FIXED:CITIZEN_1234'
|
||||
d.registrant_code.should_not == 'FIXED:CITIZEN_1234' # should not update, because pending
|
||||
d.auth_info.should == existing_pw
|
||||
d.update_pending?.should == true
|
||||
d.pending_update?.should == true
|
||||
end
|
||||
|
||||
it 'should not allow any update when status update_pending' do
|
||||
it 'should not allow any update when status pending update' do
|
||||
domain.domain_statuses.create(value: DomainStatus::PENDING_UPDATE)
|
||||
|
||||
existing_pw = domain.auth_info
|
||||
|
@ -1439,7 +1439,7 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
d.registrant_code.should_not == 'FIXED:CITIZEN_1234'
|
||||
d.auth_info.should == existing_pw
|
||||
d.update_pending?.should == true
|
||||
d.pending_update?.should == true
|
||||
end
|
||||
|
||||
it 'updates domain and adds objects' do
|
||||
|
@ -1567,6 +1567,85 @@ describe 'EPP Domain', epp: true do
|
|||
d.domain_statuses.count.should == 2
|
||||
end
|
||||
|
||||
it 'updates domain with registrant change what triggers action pending' do
|
||||
xml = domain_update_xml({
|
||||
name: { value: domain.name },
|
||||
chg: [
|
||||
registrant: { value: 'FIXED:CITIZEN_1234' }
|
||||
],
|
||||
add: [
|
||||
{
|
||||
ns: [
|
||||
{
|
||||
hostAttr: [
|
||||
{ hostName: { value: 'ns1.example.com' } }
|
||||
]
|
||||
},
|
||||
{
|
||||
hostAttr: [
|
||||
{ hostName: { value: 'ns2.example.com' } }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
_anonymus: [
|
||||
{ contact: { value: 'FIXED:PENDINGMAK21', attrs: { type: 'tech' } } },
|
||||
{ status: { value: 'Payment overdue.', attrs: { s: 'clientHold', lang: 'en' } } },
|
||||
{ status: { value: '', attrs: { s: 'clientUpdateProhibited' } } }
|
||||
]
|
||||
]
|
||||
}, {
|
||||
add: [
|
||||
{ keyData: {
|
||||
flags: { value: '0' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '5' },
|
||||
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
||||
}
|
||||
},
|
||||
{
|
||||
keyData: {
|
||||
flags: { value: '256' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '254' },
|
||||
pubKey: { value: '841936717ae427ace63c28d04918569a841936717ae427ace63c28d0' }
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response[:results][0][:msg].should == 'Contact was not found'
|
||||
response[:results][0][:result_code].should == '2303'
|
||||
|
||||
Fabricate(:contact, code: 'FIXED:PENDINGMAK21')
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response[:results][0][:msg].should == 'Command completed successfully; action pending'
|
||||
response[:results][0][:result_code].should == '1001'
|
||||
|
||||
d = Domain.last
|
||||
|
||||
new_ns_count = d.nameservers.where(hostname: ['ns1.example.com', 'ns2.example.com']).count
|
||||
new_ns_count.should == 0 # aka old value
|
||||
|
||||
new_contact = d.tech_contacts.find_by(code: 'FIXED:PENDINGMAK21')
|
||||
new_contact.should_not be_truthy # aka should not add new contact
|
||||
|
||||
d.domain_statuses.count.should == 1
|
||||
d.domain_statuses.first.value.should == 'pendingUpdate'
|
||||
|
||||
d.dnskeys.count.should == 0
|
||||
end
|
||||
|
||||
it 'does not allow to edit statuses if policy forbids it' do
|
||||
Setting.client_status_editing_enabled = false
|
||||
|
||||
|
|
4
spec/fabricators/registrant_verification_fabricator.rb
Normal file
4
spec/fabricators/registrant_verification_fabricator.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
Fabricator(:registrant_verification) do
|
||||
domain_name { sequence(:name) { |i| "domain#{i}.ee" } }
|
||||
verification_token '123'
|
||||
end
|
44
spec/features/registrant/domain_update_confirm_spec.rb
Normal file
44
spec/features/registrant/domain_update_confirm_spec.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'DomainUpdateConfirm', type: :feature do
|
||||
context 'as unknown user with domain without update token' do
|
||||
before :all do
|
||||
@domain = Fabricate(:domain)
|
||||
end
|
||||
|
||||
it 'should see warning info if token is missing request' do
|
||||
visit "/registrant/domain_update_confirms/#{@domain.id}"
|
||||
current_path.should == "/registrant/domain_update_confirms/#{@domain.id}"
|
||||
page.should have_text('Domain verification not available')
|
||||
end
|
||||
|
||||
it 'should see warning info if token is missing request' do
|
||||
visit "/registrant/domain_update_confirms/#{@domain.id}"
|
||||
current_path.should == "/registrant/domain_update_confirms/#{@domain.id}"
|
||||
page.should have_text('Domain verification not available')
|
||||
end
|
||||
end
|
||||
|
||||
context 'as unknown user with domain with update token' do
|
||||
before :all do
|
||||
@domain = Fabricate(
|
||||
:domain,
|
||||
registrant_verification_token: '123',
|
||||
registrant_verification_asked_at: Time.zone.now
|
||||
)
|
||||
@domain.domain_statuses.create(value: DomainStatus::PENDING_UPDATE)
|
||||
end
|
||||
|
||||
it 'should see warning info if token is missing in request' do
|
||||
visit "/registrant/domain_update_confirms/#{@domain.id}?token=wrong_token"
|
||||
current_path.should == "/registrant/domain_update_confirms/#{@domain.id}"
|
||||
page.should have_text('Domain verification not available')
|
||||
end
|
||||
|
||||
it 'should show domain info and confirm buttons' do
|
||||
visit "/registrant/domain_update_confirms/#{@domain.id}?token=123"
|
||||
current_path.should == "/registrant/domain_update_confirms/#{@domain.id}"
|
||||
page.should_not have_text('Domain verification not available')
|
||||
end
|
||||
end
|
||||
end
|
18
spec/features/registrant/root_spec.rb
Normal file
18
spec/features/registrant/root_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Root', type: :feature do
|
||||
it 'should redirect to registrant login page' do
|
||||
visit '/registrant/login'
|
||||
current_path.should == '/registrant/login'
|
||||
end
|
||||
|
||||
it 'should redirect to registrant login page' do
|
||||
visit '/registrant'
|
||||
current_path.should == '/registrant/login'
|
||||
end
|
||||
|
||||
it 'should redirect to registrant login page' do
|
||||
visit '/registrant/'
|
||||
current_path.should == '/registrant/login'
|
||||
end
|
||||
end
|
|
@ -32,6 +32,7 @@ describe DomainMailer do
|
|||
@domain = Fabricate(:domain, registrant: @registrant)
|
||||
@domain.deliver_emails = true
|
||||
@domain.registrant_verification_token = '123'
|
||||
@domain.registrant_verification_asked_at = Time.zone.now
|
||||
@domain.registrant = @new_registrant
|
||||
@mail = DomainMailer.registrant_updated(@domain)
|
||||
end
|
||||
|
|
|
@ -33,6 +33,10 @@ describe Domain do
|
|||
it 'should not have whois body' do
|
||||
@domain.whois_record.should == nil
|
||||
end
|
||||
|
||||
it 'should not be registrant update confirm ready' do
|
||||
@domain.registrant_update_confirmable?('123').should == false
|
||||
end
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
|
@ -77,6 +81,31 @@ describe Domain do
|
|||
@domain.whois_record.json.present?.should == true
|
||||
end
|
||||
|
||||
it 'should not be registrant update confirm ready' do
|
||||
@domain.registrant_update_confirmable?('123').should == false
|
||||
end
|
||||
|
||||
context 'about registrant update confirm' do
|
||||
before :all do
|
||||
@domain.registrant_verification_token = 123
|
||||
@domain.registrant_verification_asked_at = Time.zone.now
|
||||
@domain.domain_statuses.create(value: DomainStatus::PENDING_UPDATE)
|
||||
end
|
||||
|
||||
it 'should be registrant update confirm ready' do
|
||||
@domain.registrant_update_confirmable?('123').should == true
|
||||
end
|
||||
|
||||
it 'should not be registrant update confirm ready when token does not match' do
|
||||
@domain.registrant_update_confirmable?('wrong-token').should == false
|
||||
end
|
||||
|
||||
it 'should not be registrant update confirm ready when no correct status' do
|
||||
@domain.domain_statuses.delete_all
|
||||
@domain.registrant_update_confirmable?('123').should == false
|
||||
end
|
||||
end
|
||||
|
||||
context 'with versioning' do
|
||||
it 'should not have one version' do
|
||||
with_versioning do
|
||||
|
|
34
spec/models/registrant_verification_spec.rb
Normal file
34
spec/models/registrant_verification_spec.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe RegistrantVerification do
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
@registrant_verification = RegistrantVerification.new
|
||||
end
|
||||
|
||||
it 'should not be valid' do
|
||||
@registrant_verification.valid?
|
||||
@registrant_verification.errors.full_messages.should match_array([
|
||||
"Domain name is missing",
|
||||
"Verification token is missing"
|
||||
])
|
||||
end
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
@registrant_verification = Fabricate(:registrant_verification)
|
||||
end
|
||||
|
||||
it 'should be valid' do
|
||||
@registrant_verification.valid?
|
||||
@registrant_verification.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should be valid twice' do
|
||||
@registrant_verification = Fabricate(:registrant_verification)
|
||||
@registrant_verification.valid?
|
||||
@registrant_verification.errors.full_messages.should match_array([])
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue