mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 17:01:44 +02:00
Honor legacy contact codes
This commit is contained in:
parent
8b22c58eec
commit
834d638423
6 changed files with 74 additions and 47 deletions
|
@ -142,12 +142,58 @@ describe 'EPP Contact', epp: true do
|
|||
cr_date.text.to_time.should be_within(5).of(Time.zone.now)
|
||||
end
|
||||
|
||||
it 'successfully saves custom code' do
|
||||
response = create_request({ id: { value: '12345' } })
|
||||
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 == 'registrar1:12345'
|
||||
Contact.last.code.should == 'FIRST0:abc:ABC:12345'
|
||||
end
|
||||
|
||||
it 'should add registrar prefix for code when missing' do
|
||||
response = create_request({ id: { value: 'abc12345' } })
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.last.code.should == 'FIRST0:abc12345'
|
||||
end
|
||||
|
||||
it 'should not allow spaces in custom code' do
|
||||
response = create_request({ id: { value: 'abc 123' } })
|
||||
response[:msg].should == 'is invalid [code]'
|
||||
response[:result_code].should == '2005'
|
||||
end
|
||||
|
||||
it 'should not add registrar prefix for code when prefix present' do
|
||||
response = create_request({ id: { value: 'FIRST0:abc:ABC:NEW:12345' } })
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.last.code.should == 'FIRST0:abc:ABC:NEW:12345'
|
||||
end
|
||||
|
||||
it 'should not add registrar prefix for code when prefix present' do
|
||||
response = create_request({ id: { value: 'FIRST0:abc22' } })
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.last.code.should == 'FIRST0:abc22'
|
||||
end
|
||||
|
||||
it 'should add registrar prefix for code does not match exactly to prefix' do
|
||||
response = create_request({ id: { value: 'first0:abc:ABC:11111' } })
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.last.code.should == 'FIRST0:first0:abc:ABC:11111'
|
||||
end
|
||||
|
||||
it 'should ignore custom code when value is prefix' do
|
||||
response = create_request({ id: { value: 'FIRST0' } })
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.last.code.match(':').should == nil
|
||||
end
|
||||
|
||||
it 'should generate server id when id is empty' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue