mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 20:18:22 +02:00
parent
1ae00382cd
commit
5b4658b905
2 changed files with 44 additions and 23 deletions
|
@ -158,7 +158,11 @@ class Epp::Contact < Contact
|
|||
# https://github.com/internetee/registry/issues/576
|
||||
if ident_frame
|
||||
if identifier.valid?
|
||||
report_valid_ident_error
|
||||
submitted_ident = Ident.new(code: ident_frame.text,
|
||||
type: ident_frame.attr('type'),
|
||||
country_code: ident_frame.attr('cc'))
|
||||
|
||||
report_valid_ident_error if submitted_ident != identifier
|
||||
else
|
||||
ident_update_attempt = ident_frame.text.present? && (ident_frame.text != ident)
|
||||
report_ident_update_error if ident_update_attempt
|
||||
|
|
|
@ -34,34 +34,51 @@ RSpec.describe 'EPP contact:update' do
|
|||
end
|
||||
|
||||
context 'when contact ident is valid' do
|
||||
let!(:contact) { create(:contact, code: 'TEST', ident: 'test', ident_type: 'priv', ident_country_code: 'US') }
|
||||
context 'when submitted ident matches current one' do
|
||||
let!(:contact) { create(:contact, code: 'TEST',
|
||||
ident: 'test',
|
||||
ident_type: 'priv',
|
||||
ident_country_code: 'US') }
|
||||
|
||||
it 'does not update code' do
|
||||
expect do
|
||||
specify do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.code }
|
||||
expect(epp_response).to have_result(:success)
|
||||
end
|
||||
end
|
||||
|
||||
it 'does not update type' do
|
||||
expect do
|
||||
context 'when submitted ident does not match current one' do
|
||||
let!(:contact) { create(:contact, code: 'TEST',
|
||||
ident: 'another-test',
|
||||
ident_type: 'priv',
|
||||
ident_country_code: 'US') }
|
||||
|
||||
it 'does not update code' do
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.code }
|
||||
end
|
||||
|
||||
it 'does not update type' do
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.type }
|
||||
end
|
||||
|
||||
it 'does not update country code' do
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.country_code }
|
||||
end
|
||||
|
||||
specify do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.type }
|
||||
end
|
||||
|
||||
it 'does not update country code' do
|
||||
expect do
|
||||
request
|
||||
contact.reload
|
||||
end.to_not change { ident.country_code }
|
||||
end
|
||||
|
||||
specify do
|
||||
request
|
||||
|
||||
expect(epp_response).to have_result(:data_management_policy_violation,
|
||||
t('epp.contacts.errors.valid_ident'))
|
||||
expect(epp_response).to have_result(:data_management_policy_violation,
|
||||
t('epp.contacts.errors.valid_ident'))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue