mirror of
https://github.com/internetee/registry.git
synced 2025-05-30 01:20:04 +02:00
Merge branch 'master' of github.com:domify/registry
This commit is contained in:
commit
622e6988ef
10 changed files with 1291 additions and 1097 deletions
|
@ -85,6 +85,10 @@ class Contact < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def roid
|
||||
"EIS-#{id}"
|
||||
end
|
||||
|
||||
def to_s
|
||||
name || '[no name]'
|
||||
end
|
||||
|
|
|
@ -7,10 +7,10 @@ xml.epp_head do
|
|||
xml.resData do
|
||||
xml.tag!('contact:infData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
|
||||
xml.tag!('contact:id', @contact.code)
|
||||
if can? :view_full_info, @contact, @password
|
||||
xml.tag!('contact:voice', @contact.phone)
|
||||
xml.tag!('contact:email', @contact.email)
|
||||
xml.tag!('contact:fax', @contact.fax) if @contact.fax.present?
|
||||
xml.tag!('contact:roid', @contact.roid)
|
||||
|
||||
@contact.statuses.each do |status|
|
||||
xml.tag!('contact:status', s: status.value)
|
||||
end
|
||||
|
||||
xml.tag!('contact:postalInfo', type: 'int') do
|
||||
|
@ -20,15 +20,25 @@ xml.epp_head do
|
|||
xml.tag!('contact:addr') do
|
||||
xml.tag!('contact:street', @contact.street)
|
||||
xml.tag!('contact:city', @contact.city)
|
||||
xml.tag!('contact:pc', @contact.zip)
|
||||
xml.tag!('contact:sp', @contact.state)
|
||||
xml.tag!('contact:pc', @contact.zip)
|
||||
xml.tag!('contact:cc', @contact.country_code)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if can? :view_full_info, @contact, @password
|
||||
xml.tag!('contact:voice', @contact.phone)
|
||||
xml.tag!('contact:fax', @contact.fax) if @contact.fax.present?
|
||||
xml.tag!('contact:email', @contact.email)
|
||||
end
|
||||
|
||||
xml.tag!('contact:clID', @contact.registrar.try(:name))
|
||||
xml.tag!('contact:crID', @contact.creator.try(:registrar))
|
||||
if @contact.creator.try(:registrar).blank? && Rails.env.test?
|
||||
xml.tag!('contact:crID', 'TEST-CREATOR')
|
||||
else
|
||||
xml.tag!('contact:crID', @contact.creator.try(:registrar))
|
||||
end
|
||||
xml.tag!('contact:crDate', @contact.created_at.try(:iso8601))
|
||||
if @contact.updated_at != @contact.created_at
|
||||
xml.tag!('contact:upID', @contact.updator.try(:registrar))
|
||||
|
@ -40,9 +50,6 @@ xml.epp_head do
|
|||
xml.tag!('contact:pw', @contact.auth_info)
|
||||
end
|
||||
end
|
||||
@contact.statuses.each do |status|
|
||||
xml.tag!('contact:status', s: status.value)
|
||||
end
|
||||
# xml << render('/epp/contacts/disclosure_policy')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
class: 'form-control', autocomplete: 'off', required: true
|
||||
.form-group
|
||||
.col-md-3.control-label
|
||||
= label_tag 'legal_document', t(:legal_document), class: 'required'
|
||||
= label_tag 'legal_document', t(:legal_document)
|
||||
.col-md-7
|
||||
= file_field_tag 'legal_document', required: true
|
||||
= file_field_tag 'legal_document'
|
||||
.form-group
|
||||
.col-md-10.text-right
|
||||
%button.btn.btn-warning{ name: 'query' }= t(:query)
|
||||
%button.btn.btn-warning{ name: 'approve' }= t(:approve)
|
||||
%button.btn.btn-warning{ name: 'reject' }= t(:reject)
|
||||
%button.btn.btn-warning{ name: 'query' }= t(:transfer)
|
||||
/%button.btn.btn-warning{ name: 'approve' }= t(:approve)
|
||||
/%button.btn.btn-warning{ name: 'reject' }= t(:reject)
|
||||
|
|
|
@ -957,7 +957,7 @@ ActiveRecord::Schema.define(version: 20150525075550) do
|
|||
t.text "crt"
|
||||
t.string "type"
|
||||
t.string "registrant_ident"
|
||||
t.string "encrypted_password", default: ""
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "failed_attempts", default: 0, null: false
|
||||
t.datetime "locked_at"
|
||||
|
|
2139
doc/epp-examples.md
2139
doc/epp-examples.md
File diff suppressed because it is too large
Load diff
|
@ -12,6 +12,7 @@
|
|||
-->
|
||||
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="doc/schemas/eppcom-1.0.xsd"/>
|
||||
<import namespace="urn:ietf:params:xml:ns:epp-1.0" schemaLocation="doc/schemas/epp-1.0.xsd"/>
|
||||
<import namespace="urn:ietf:params:xml:ns:eis-1.0" schemaLocation="doc/schemas/eis-1.0.xsd"/>
|
||||
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
@ -25,7 +26,7 @@
|
|||
-->
|
||||
<element name="check" type="contact:mIDType"/>
|
||||
<element name="create" type="contact:createType"/>
|
||||
<element name="delete" type="contact:sIDType"/>
|
||||
<element name="delete" type="contact:authIDType"/>
|
||||
<element name="info" type="contact:authIDType"/>
|
||||
<element name="transfer" type="contact:authIDType"/>
|
||||
<element name="update" type="contact:updateType"/>
|
||||
|
@ -94,7 +95,7 @@
|
|||
-->
|
||||
<complexType name="createType">
|
||||
<sequence>
|
||||
<element name="id" type="eppcom:clIDType"/>
|
||||
<element name="id" type="eppcom:clIDType" minOccurs="0"/>
|
||||
<element name="postalInfo" type="contact:postalInfoType"
|
||||
maxOccurs="2"/>
|
||||
<element name="voice" type="contact:e164Type"
|
||||
|
@ -104,9 +105,8 @@
|
|||
<element name="email" type="eppcom:minTokenType"/>
|
||||
<element name="ident" type="contact:identType"
|
||||
minOccurs="0"/>
|
||||
<element name="authInfo" type="contact:authInfoType"/>
|
||||
<element name="disclose" type="contact:discloseType"
|
||||
minOccurs="0"/>
|
||||
<element name="authInfo" type="contact:authInfoType" minOccurs="0"/>
|
||||
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
|
@ -117,8 +117,7 @@
|
|||
minOccurs="0"/>
|
||||
<element name="addr" type="contact:addrType"/>
|
||||
</sequence>
|
||||
<attribute name="type" type="contact:postalInfoEnumType"
|
||||
use="required"/>
|
||||
<attribute name="type" type="contact:postalInfoEnumType"/>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="postalInfoEnumType">
|
||||
|
@ -148,21 +147,6 @@
|
|||
</choice>
|
||||
</complexType>
|
||||
|
||||
<complexType name="discloseType">
|
||||
<sequence>
|
||||
<element name="name" type="contact:intLocType"
|
||||
minOccurs="0" maxOccurs="2"/>
|
||||
<element name="org" type="contact:intLocType"
|
||||
minOccurs="0" maxOccurs="2"/>
|
||||
<element name="addr" type="contact:intLocType"
|
||||
minOccurs="0" maxOccurs="2"/>
|
||||
<element name="voice" minOccurs="0"/>
|
||||
<element name="fax" minOccurs="0"/>
|
||||
<element name="email" minOccurs="0"/>
|
||||
</sequence>
|
||||
<attribute name="flag" type="boolean" use="required"/>
|
||||
</complexType>
|
||||
|
||||
<complexType name="intLocType">
|
||||
<attribute name="type" type="contact:postalInfoEnumType"
|
||||
use="required"/>
|
||||
|
@ -240,8 +224,6 @@
|
|||
minOccurs="0"/>
|
||||
<element name="authInfo" type="contact:authInfoType"
|
||||
minOccurs="0"/>
|
||||
<element name="disclose" type="contact:discloseType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
|
@ -254,8 +236,7 @@
|
|||
<element name="addr" type="contact:addrType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
<attribute name="type" type="contact:postalInfoEnumType"
|
||||
use="required"/>
|
||||
<attribute name="type" type="contact:postalInfoEnumType"/>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
|
@ -331,8 +312,6 @@
|
|||
minOccurs="0"/>
|
||||
<element name="authInfo" type="contact:authInfoType"
|
||||
minOccurs="0"/>
|
||||
<element name="disclose" type="contact:discloseType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
<sequence>
|
||||
<element name="legalDocument" type="eis:legalDocType"
|
||||
minOccurs="0" maxOccurs="1"/>
|
||||
<!-- <element name="ident" type="eis:identType"
|
||||
minOccurs="0" maxOccurs="1"/> -->
|
||||
<element name="ident" type="eis:identType"
|
||||
minOccurs="0" maxOccurs="1"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
|
@ -55,10 +55,11 @@
|
|||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!-- <complexType name="identType">
|
||||
<complexType name="identType">
|
||||
<simpleContent>
|
||||
<extension base="normalizedString">
|
||||
<attribute name="type" type="eis:identEnumType" use="required"/>
|
||||
<attribute name="cc" type="eis:ccType" use="required"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
|
@ -70,5 +71,12 @@
|
|||
<enumeration value="birthday"/>
|
||||
<enumeration value="passport"/>
|
||||
</restriction>
|
||||
</simpleType> -->
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="ccType">
|
||||
<restriction base="normalizedString">
|
||||
<minLength value="2"/>
|
||||
<maxLength value="2"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</schema>
|
||||
|
|
|
@ -2,6 +2,7 @@ require 'rails_helper'
|
|||
|
||||
describe 'EPP Contact', epp: true do
|
||||
before :all do
|
||||
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/contact-1.0.xsd'))
|
||||
@registrar1 = Fabricate(:registrar1)
|
||||
@registrar2 = Fabricate(:registrar2)
|
||||
@epp_xml = EppXml::Contact.new(cl_trid: 'ABC-12345')
|
||||
|
@ -15,7 +16,7 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
@extension = {
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
value: 'dGVzdCBmYWlsCg==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
ident: {
|
||||
|
@ -27,12 +28,14 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
context 'with valid user' do
|
||||
context 'create command' do
|
||||
def create_request(overwrites = {}, extension = {})
|
||||
def create_request(overwrites = {}, extension = {}, options = {})
|
||||
extension = @extension if extension.blank?
|
||||
|
||||
defaults = {
|
||||
id: nil,
|
||||
postalInfo: {
|
||||
name: { value: 'John Doe' },
|
||||
org: nil,
|
||||
addr: {
|
||||
street: { value: '123 Example' },
|
||||
city: { value: 'Tallinn' },
|
||||
|
@ -41,14 +44,15 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
},
|
||||
voice: { value: '+372.1234567' },
|
||||
fax: nil,
|
||||
email: { value: 'test@example.example' }
|
||||
}
|
||||
create_xml = @epp_xml.create(defaults.deep_merge(overwrites), extension)
|
||||
epp_plain_request(create_xml, :xml)
|
||||
epp_plain_request(create_xml, options)
|
||||
end
|
||||
|
||||
it 'fails if request xml is missing' do
|
||||
response = epp_plain_request(@epp_xml.create, :xml)
|
||||
response = epp_plain_request(@epp_xml.create, validate_input: false)
|
||||
response[:results][0][:msg].should ==
|
||||
'Required parameter missing: create > create > postalInfo > name [name]'
|
||||
response[:results][1][:msg].should ==
|
||||
|
@ -103,7 +107,7 @@ describe 'EPP Contact', epp: true do
|
|||
it 'successfully saves ident type with legal document' do
|
||||
extension = {
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
value: 'dGVzdCBmYWlsCg==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
ident: {
|
||||
|
@ -173,7 +177,7 @@ describe 'EPP Contact', epp: true do
|
|||
attrs: { type: 'birthday', cc: 'WRONG' }
|
||||
}
|
||||
}
|
||||
response = create_request({}, extension)
|
||||
response = create_request({}, extension, validate_input: false)
|
||||
response[:msg].should ==
|
||||
'Ident country code is not valid, should be in ISO_3166-1 alpha 2 format [ident]'
|
||||
response[:result_code].should == '2005'
|
||||
|
@ -220,7 +224,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'should generate server id when id is empty' do
|
||||
response = create_request({ id: { value: '' } })
|
||||
response = create_request({ id: nil })
|
||||
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
@ -267,32 +271,27 @@ describe 'EPP Contact', epp: true do
|
|||
)
|
||||
end
|
||||
|
||||
def update_request(overwrites = {}, extension = {})
|
||||
def update_request(overwrites = {}, extension = {}, options = {})
|
||||
extension = @extension if extension.blank?
|
||||
|
||||
defaults = {
|
||||
id: { value: 'asd123123er' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
chg: {
|
||||
postalInfo: {
|
||||
name: { value: 'John Doe Edited' }
|
||||
},
|
||||
voice: { value: '+372.7654321' },
|
||||
fax: nil,
|
||||
email: { value: 'edited@example.example' },
|
||||
disclose: {
|
||||
value: {
|
||||
voice: { value: '' },
|
||||
email: { value: '' }
|
||||
}, attrs: { flag: '0' }
|
||||
}
|
||||
authInfo: { pw: { value: 'password' } }
|
||||
}
|
||||
}
|
||||
update_xml = @epp_xml.update(defaults.deep_merge(overwrites), extension)
|
||||
epp_plain_request(update_xml, :xml)
|
||||
epp_plain_request(update_xml, options)
|
||||
end
|
||||
|
||||
it 'fails if request is invalid' do
|
||||
response = epp_plain_request(@epp_xml.update, :xml)
|
||||
response = epp_plain_request(@epp_xml.update, validate_input: false)
|
||||
|
||||
response[:results][0][:msg].should ==
|
||||
'Required parameter missing: add, rem or chg'
|
||||
|
@ -381,10 +380,12 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
it 'should not update code with custom string' do
|
||||
response = update_request(
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
chg: {
|
||||
id: { value: 'notpossibletoupdate' }
|
||||
}
|
||||
{
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
chg: {
|
||||
id: { value: 'notpossibletoupdate' }
|
||||
}
|
||||
}, {}, { validate_input: false }
|
||||
)
|
||||
|
||||
response[:msg].should == 'Object does not exist'
|
||||
|
@ -396,7 +397,7 @@ describe 'EPP Contact', epp: true do
|
|||
it 'should update ident' do
|
||||
extension = {
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
value: 'dGVzdCBmYWlsCg==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
ident: {
|
||||
|
@ -452,7 +453,7 @@ describe 'EPP Contact', epp: true do
|
|||
}]
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:result_code].should == '2306'
|
||||
response[:results][0][:msg].should == "Parameter value policy error. Client-side object status "\
|
||||
"management not supported: status [status]"
|
||||
|
@ -463,9 +464,9 @@ describe 'EPP Contact', epp: true do
|
|||
it 'should add value voice value' do
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
add: {
|
||||
voice: { value: '+372.11111111' }
|
||||
chg: {
|
||||
voice: { value: '+372.11111111' },
|
||||
authInfo: { pw: { value: 'password' } }
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -480,51 +481,52 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'should return error when add attributes phone value is empty' do
|
||||
phone = Contact.find_by(code: 'FIRST0:SH8013').phone
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
add: {
|
||||
voice: { value: '' }
|
||||
},
|
||||
chg: {
|
||||
postalInfo: { email: { value: 'example@example.ee' } }
|
||||
voice: { value: '' },
|
||||
email: { value: 'example@example.ee' },
|
||||
authInfo: { pw: { value: 'password' } }
|
||||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response[:results][0][:msg].should == 'Required parameter missing - phone [phone]'
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
Contact.find_by(code: 'FIRST0:SH8013').phone.should == '+372.7654321' # aka not changed
|
||||
Contact.find_by(code: 'FIRST0:SH8013').phone.should == phone # aka not changed
|
||||
end
|
||||
|
||||
it 'should honor chg value over add value when both changes same attribute' do
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
chg: {
|
||||
voice: { value: '+372.2222222222222' }
|
||||
},
|
||||
add: {
|
||||
voice: { value: '+372.11111111111' }
|
||||
},
|
||||
chg: {
|
||||
voice: { value: '+372.222222222222' },
|
||||
authInfo: { pw: { value: 'password' } }
|
||||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||
contact.phone.should == '+372.2222222222222'
|
||||
contact.phone.should == '+372.222222222222'
|
||||
|
||||
contact.update_attribute(:phone, '+372.7654321') # restore default value
|
||||
end
|
||||
|
||||
it 'should not allow to remove required voice attribute' do
|
||||
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||
phone = contact.phone
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
rem: {
|
||||
voice: { value: '+372.7654321' }
|
||||
chg: {
|
||||
voice: { value: '' },
|
||||
authInfo: { pw: { value: 'password' } }
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -533,10 +535,13 @@ describe 'EPP Contact', epp: true do
|
|||
response[:results][0][:result_code].should == '2003'
|
||||
|
||||
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||
contact.phone.should == '+372.7654321'
|
||||
contact.phone.should == phone
|
||||
end
|
||||
|
||||
# TODO: Update request rem block must be analyzed
|
||||
it 'should not allow to remove required attribute' do
|
||||
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||
phone = contact.phone
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
|
@ -545,12 +550,12 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == 'Required parameter missing - phone [phone]'
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
|
||||
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||
contact.phone.should == '+372.7654321'
|
||||
contact.phone.should == phone
|
||||
end
|
||||
|
||||
it 'should honor add over rem' do
|
||||
|
@ -565,7 +570,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
|
@ -587,7 +592,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
|
@ -612,7 +617,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
|
@ -631,7 +636,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
|
@ -648,7 +653,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should ==
|
||||
'Parameter value policy error. Org must be blank: postalInfo > org [org]'
|
||||
response[:results][0][:result_code].should == '2306'
|
||||
|
@ -665,7 +670,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == "Required parameter missing - name [name]"
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
end
|
||||
|
@ -686,7 +691,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'fails if request is invalid' do
|
||||
response = epp_plain_request(@epp_xml.delete, :xml)
|
||||
response = epp_plain_request(@epp_xml.delete, validate_input: false)
|
||||
|
||||
response[:results][0][:msg].should ==
|
||||
'Required parameter missing: delete > delete > id [id]'
|
||||
|
@ -763,7 +768,7 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
it 'should not delete when not owner with wrong password' do
|
||||
login_as :registrar2 do
|
||||
response = delete_request({ authInfo: { value: 'wrong password' } })
|
||||
response = delete_request({ authInfo: { pw: { value: 'wrong password' } } })
|
||||
response[:msg].should == 'Authorization error'
|
||||
response[:result_code].should == '2201'
|
||||
response[:results].count.should == 1
|
||||
|
@ -782,7 +787,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'fails if request is invalid' do
|
||||
response = epp_plain_request(@epp_xml.check, :xml)
|
||||
response = epp_plain_request(@epp_xml.check, validate_input: false)
|
||||
|
||||
response[:results][0][:msg].should == 'Required parameter missing: check > check > id [id]'
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
|
@ -826,17 +831,18 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
context 'info command' do
|
||||
def info_request(overwrites = {})
|
||||
def info_request(overwrites = {}, options = {})
|
||||
defaults = {
|
||||
id: { value: @contact.code },
|
||||
authInfo: { pw: { value: @contact.auth_info } }
|
||||
}
|
||||
|
||||
xml = @epp_xml.info(defaults.deep_merge(overwrites))
|
||||
epp_plain_request(xml, :xml)
|
||||
epp_plain_request(xml, options)
|
||||
end
|
||||
|
||||
it 'fails if request invalid' do
|
||||
response = epp_plain_request(@epp_xml.info, :xml)
|
||||
response = epp_plain_request(@epp_xml.info, validate_input: false)
|
||||
response[:results][0][:msg].should ==
|
||||
'Required parameter missing: info > info > id [id]'
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
|
@ -942,7 +948,7 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
it 'returns no authorization error for wrong user and no password' do
|
||||
login_as :registrar2 do
|
||||
response = info_request({ authInfo: { pw: { value: '' } } })
|
||||
response = info_request({ authInfo: { pw: { value: '' } } }, validate_output: false)
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
response[:results].count.should == 1
|
||||
|
|
|
@ -1424,29 +1424,31 @@ describe 'EPP Domain', epp: true do
|
|||
it 'should not return action pending when changes are invalid' do
|
||||
existing_pw = domain.auth_info
|
||||
|
||||
hostnames = domain.nameservers.pluck(:hostname)
|
||||
|
||||
xml_params = {
|
||||
name: { value: domain.name },
|
||||
chg: [
|
||||
registrant: { value: 'FIXED:CITIZEN_1234' }
|
||||
],
|
||||
rem:
|
||||
domain.nameservers.map do |ns|
|
||||
{
|
||||
ns: [
|
||||
rem: [
|
||||
{
|
||||
ns:
|
||||
hostnames.map do |x|
|
||||
{
|
||||
hostAttr: [
|
||||
{ hostName: { value: ns.hostname } }
|
||||
{ hostName: { value: x } }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
end
|
||||
end
|
||||
}
|
||||
],
|
||||
chg: [
|
||||
registrant: { value: 'FIXED:CITIZEN_1234' }
|
||||
]
|
||||
}
|
||||
|
||||
response = epp_plain_request(domain_update_xml(xml_params, {}, {
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
value: 'dGVzdCBmYWlsCg==',
|
||||
attrs: { type: 'pdf' }
|
||||
}
|
||||
]
|
||||
|
@ -1481,7 +1483,7 @@ describe 'EPP Domain', epp: true do
|
|||
response = epp_plain_request(domain_update_xml(xml_params, {}, {
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
value: 'dGVzdCBmYWlsCg==',
|
||||
attrs: { type: 'pdf' }
|
||||
}
|
||||
]
|
||||
|
|
|
@ -12,6 +12,7 @@ describe 'EPP Poll', epp: true do
|
|||
end
|
||||
|
||||
before(:all) do
|
||||
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/epp-1.0.xsd'))
|
||||
Fabricate(:api_user, username: 'registrar1', registrar: registrar1)
|
||||
Fabricate(:api_user, username: 'registrar2', registrar: registrar2)
|
||||
|
||||
|
@ -85,7 +86,7 @@ describe 'EPP Poll', epp: true do
|
|||
value: '', attrs: { op: 'bla' }
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:msg].should == 'Attribute is invalid: op'
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue