mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Updated contact doc and added too long epp message #2753
This commit is contained in:
parent
1143e16354
commit
d4a0f1e783
7 changed files with 19 additions and 16 deletions
|
@ -102,7 +102,7 @@ class EppController < ApplicationController
|
||||||
msg: 'handle_errors was executed when there were actually no errors'
|
msg: 'handle_errors was executed when there were actually no errors'
|
||||||
}
|
}
|
||||||
# rubocop:disable Rails/Output
|
# rubocop:disable Rails/Output
|
||||||
puts obj.errors.full_messages if Rails.env.test?
|
puts "FULL MESSAGE: #{obj.errors.full_messages} #{obj.errors.inspect}" if Rails.env.test?
|
||||||
# rubocop: enable Rails/Output
|
# rubocop: enable Rails/Output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ class Contact < ActiveRecord::Base
|
||||||
validates :ident_country_code, presence: true, if: proc { |c| %w(bic priv).include? c.ident_type }
|
validates :ident_country_code, presence: true, if: proc { |c| %w(bic priv).include? c.ident_type }
|
||||||
validates :code,
|
validates :code,
|
||||||
uniqueness: { message: :epp_id_taken },
|
uniqueness: { message: :epp_id_taken },
|
||||||
format: { with: /\A[\w\-\:]*\Z/i },
|
format: { with: /\A[\w\-\:]*\Z/i, message: :invalid },
|
||||||
length: { maximum: 100 }
|
length: { maximum: 100, message: :too_long_contact_code }
|
||||||
validate :ident_valid_format?
|
validate :ident_valid_format?
|
||||||
|
|
||||||
before_validation :set_ident_country_code
|
before_validation :set_ident_country_code
|
||||||
|
|
|
@ -125,7 +125,9 @@ class Epp::Contact < Contact
|
||||||
[:ident, :invalid],
|
[:ident, :invalid],
|
||||||
[:ident, :invalid_EE_identity_format],
|
[:ident, :invalid_EE_identity_format],
|
||||||
[:ident, :invalid_birthday_format],
|
[:ident, :invalid_birthday_format],
|
||||||
[:ident, :invalid_country_code]
|
[:ident, :invalid_country_code],
|
||||||
|
[:code, :invalid],
|
||||||
|
[:code, :too_long_contact_code]
|
||||||
],
|
],
|
||||||
'2302' => [ # Object exists
|
'2302' => [ # Object exists
|
||||||
[:code, :epp_id_taken]
|
[:code, :epp_id_taken]
|
||||||
|
|
|
@ -36,6 +36,7 @@ en:
|
||||||
attributes:
|
attributes:
|
||||||
code:
|
code:
|
||||||
blank: "Required parameter missing - code"
|
blank: "Required parameter missing - code"
|
||||||
|
too_long_contact_code: "Contact code is too long, max 100 characters"
|
||||||
name:
|
name:
|
||||||
blank: "Required parameter missing - name"
|
blank: "Required parameter missing - name"
|
||||||
phone:
|
phone:
|
||||||
|
|
|
@ -13,7 +13,8 @@ Contact Mapping protocol short version:
|
||||||
----------------------- ------- -----------------
|
----------------------- ------- -----------------
|
||||||
<create> 1
|
<create> 1
|
||||||
<contact:create> 1 Attribute: xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"
|
<contact:create> 1 Attribute: xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd"
|
||||||
<contact:id> 0-1 Contact id, optional, generated automatically if missing
|
<contact:id> 0-1 Contact id, optional, string, no spaces, max 100 characters,
|
||||||
|
generated automatically if missing
|
||||||
<contact:postalInfo> 1 Postal information container
|
<contact:postalInfo> 1 Postal information container
|
||||||
<contact:name> 1 Full name of the contact
|
<contact:name> 1 Full name of the contact
|
||||||
<contact:org> 0 Org is not supported and must be blank or missing
|
<contact:org> 0 Org is not supported and must be blank or missing
|
||||||
|
|
|
@ -170,26 +170,25 @@ describe 'EPP Contact', epp: true do
|
||||||
Contact.last.code.should == 'FIRST0:ABC:ABC:12345'
|
Contact.last.code.should == 'FIRST0:ABC:ABC:12345'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should add registrar prefix for code when missing' do
|
|
||||||
response = create_request({ id: { value: 'abc:ABC:12345' } })
|
|
||||||
response[:msg].should == 'Command completed successfully'
|
|
||||||
response[:result_code].should == '1000'
|
|
||||||
|
|
||||||
Contact.last.code.should == 'FIRST0:ABC:ABC:12345'
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should not allow spaces in custom code' do
|
it 'should not allow spaces in custom code' do
|
||||||
response = create_request({ id: { value: 'abc 123' } })
|
response = create_request({ id: { value: 'abc 123' } })
|
||||||
response[:msg].should == 'is invalid [code]'
|
response[:msg].should == 'is invalid [code]'
|
||||||
response[:result_code].should == '2005'
|
response[:result_code].should == '2005'
|
||||||
end
|
end
|
||||||
|
|
||||||
fit 'should not allow spaces in custom code' do
|
it 'should not strange characters in custom code' do
|
||||||
response = create_request({ id: { value: '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' } })
|
response = create_request({ id: { value: '33&$@@' } })
|
||||||
response[:msg].should == 'is invalid [code]'
|
response[:msg].should == 'is invalid [code]'
|
||||||
response[:result_code].should == '2005'
|
response[:result_code].should == '2005'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should not strange characters in custom code' do
|
||||||
|
long_str = 'a' * 1000
|
||||||
|
response = create_request({ id: { value: long_str } })
|
||||||
|
response[:msg].should == 'Contact code is too long, max 100 characters [code]'
|
||||||
|
response[:result_code].should == '2005'
|
||||||
|
end
|
||||||
|
|
||||||
it 'should not saves ident type with wrong country code' do
|
it 'should not saves ident type with wrong country code' do
|
||||||
extension = {
|
extension = {
|
||||||
ident: {
|
ident: {
|
||||||
|
|
|
@ -97,7 +97,7 @@ describe Contact do
|
||||||
it 'should not accept long code' do
|
it 'should not accept long code' do
|
||||||
@contact.code = 'verylongcode' * 100
|
@contact.code = 'verylongcode' * 100
|
||||||
@contact.valid?
|
@contact.valid?
|
||||||
@contact.errors[:code].should == ['is too long (maximum is 100 characters)']
|
@contact.errors[:code].should == ['Contact code is too long, max 100 characters']
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have no related domain descriptions' do
|
it 'should have no related domain descriptions' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue