mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 02:05:57 +02:00
Ident now in extension section
This commit is contained in:
parent
cec7a27177
commit
58176b3cfa
4 changed files with 81 additions and 36 deletions
|
@ -15,17 +15,23 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
@contact = Fabricate(:contact, registrar: @registrar1)
|
||||
|
||||
@legal_document = {
|
||||
@extension = {
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
ident: {
|
||||
value: '37605030299',
|
||||
attrs: { type: 'priv', cc: 'EE' }
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
context 'with valid user' do
|
||||
context 'create command' do
|
||||
def create_request(overwrites = {})
|
||||
def create_request(overwrites = {}, extension = {})
|
||||
extension = @extension if extension.blank?
|
||||
|
||||
defaults = {
|
||||
postalInfo: {
|
||||
name: { value: 'John Doe' },
|
||||
|
@ -36,10 +42,9 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
},
|
||||
voice: { value: '+372.1234567' },
|
||||
email: { value: 'test@example.example' },
|
||||
ident: { value: '37605030299', attrs: { type: 'priv', cc: 'EE' } }
|
||||
email: { value: 'test@example.example' }
|
||||
}
|
||||
create_xml = @epp_xml.create(defaults.deep_merge(overwrites), @legal_document)
|
||||
create_xml = @epp_xml.create(defaults.deep_merge(overwrites), extension)
|
||||
epp_plain_request(create_xml, :xml)
|
||||
end
|
||||
|
||||
|
@ -52,11 +57,11 @@ describe 'EPP Contact', epp: true do
|
|||
response[:results][2][:msg].should ==
|
||||
'Required parameter missing: create > create > postalInfo > addr > cc [cc]'
|
||||
response[:results][3][:msg].should ==
|
||||
'Required parameter missing: create > create > ident [ident]'
|
||||
response[:results][4][:msg].should ==
|
||||
'Required parameter missing: create > create > voice [voice]'
|
||||
response[:results][5][:msg].should ==
|
||||
response[:results][4][:msg].should ==
|
||||
'Required parameter missing: create > create > email [email]'
|
||||
response[:results][5][:msg].should ==
|
||||
'Required parameter missing: extension > extdata > ident [ident]'
|
||||
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
response[:results][1][:result_code].should == '2003'
|
||||
|
@ -91,9 +96,17 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'successfully saves ident type' do
|
||||
response = create_request(
|
||||
{ ident: { value: '1990-22-12', attrs: { type: 'birthday' } } }
|
||||
)
|
||||
extension = {
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
ident: {
|
||||
value: '1990-22-12',
|
||||
attrs: { type: 'birthday', cc: 'US' }
|
||||
}
|
||||
}
|
||||
response = create_request({}, extension)
|
||||
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
@ -147,7 +160,9 @@ describe 'EPP Contact', epp: true do
|
|||
)
|
||||
end
|
||||
|
||||
def update_request(overwrites = {})
|
||||
def update_request(overwrites = {}, extension = {})
|
||||
extension = @extension if extension.blank?
|
||||
|
||||
defaults = {
|
||||
id: { value: 'asd123123er' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
|
@ -165,7 +180,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
}
|
||||
}
|
||||
update_xml = @epp_xml.update(defaults.deep_merge(overwrites), @legal_document)
|
||||
update_xml = @epp_xml.update(defaults.deep_merge(overwrites), extension)
|
||||
epp_plain_request(update_xml, :xml)
|
||||
end
|
||||
|
||||
|
@ -236,6 +251,24 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
@contact.reload.code.should == 'sh8013'
|
||||
end
|
||||
|
||||
it 'should update ident' do
|
||||
extension = {
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
ident: {
|
||||
value: '1990-22-12',
|
||||
attrs: { type: 'birthday', cc: 'US' }
|
||||
}
|
||||
}
|
||||
response = update_request({ id: { value: 'sh8013' } }, extension)
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.find_by(code: 'sh8013').ident_type.should == 'birthday'
|
||||
end
|
||||
end
|
||||
|
||||
context 'delete command' do
|
||||
|
@ -248,7 +281,7 @@ describe 'EPP Contact', epp: true do
|
|||
id: { value: @contact.code },
|
||||
authInfo: { pw: { value: @contact.auth_info } }
|
||||
}
|
||||
delete_xml = @epp_xml.delete(defaults.deep_merge(overwrites), @legal_document)
|
||||
delete_xml = @epp_xml.delete(defaults.deep_merge(overwrites), @extension)
|
||||
epp_plain_request(delete_xml, :xml)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue