mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 17:01:44 +02:00
Merge branch 'master' of github.com:internetee/registry
This commit is contained in:
commit
eaa9b015e2
9 changed files with 118 additions and 69 deletions
|
@ -31,6 +31,8 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
expect(Contact.count).to eq(1)
|
||||
expect(Contact.first.org_name).to eq('Example Inc.')
|
||||
expect(Contact.first.ident).to eq '37605030299'
|
||||
expect(Contact.first.ident_type).to eq 'op'
|
||||
|
||||
expect(Contact.first.address.street).to eq('123 Example Dr.')
|
||||
expect(Contact.first.address.street2).to eq('Suite 100')
|
||||
|
@ -68,8 +70,8 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
context 'update command' do
|
||||
it "fails if request is invalid" do
|
||||
#response = epp_request('contacts/update_missing_attr.xml')
|
||||
response = epp_request(contact_update_xml( {id: false} ), :xml)
|
||||
response = epp_request('contacts/update_missing_attr.xml')
|
||||
#response = epp_request(contact_update_xml( {id: false} ), :xml)
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2003')
|
||||
expect(response[:results][0][:msg]).to eq('Required parameter missing: id')
|
||||
|
@ -88,16 +90,20 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
it 'is succesful' do
|
||||
Fabricate(:contact, created_by_id: 1, email: 'not_updated@test.test', code: 'sh8013')
|
||||
response = epp_request(contact_update_xml( { chg: { email: 'fred@bloggers.ee', postalInfo: { name: 'Fred Bloggers' } } } ), :xml)
|
||||
#response = epp_request(contact_update_xml( { chg: { email: 'fred@bloggers.ee', postalInfo: { name: 'Fred Bloggers' } } } ), :xml)
|
||||
response = epp_request('contacts/update.xml')
|
||||
|
||||
expect(response[:msg]).to eq('Command completed successfully')
|
||||
expect(Contact.first.name).to eq('Fred Bloggers')
|
||||
expect(Contact.first.email).to eq('fred@bloggers.ee')
|
||||
expect(Contact.first.name).to eq('John Doe')
|
||||
expect(Contact.first.email).to eq('jdoe@example.com')
|
||||
expect(Contact.first.ident).to eq('J836954')
|
||||
expect(Contact.first.ident_type).to eq('passport')
|
||||
end
|
||||
|
||||
it 'returns phone and email error' do
|
||||
Fabricate(:contact, created_by_id: 1, email: 'not_updated@test.test', code: 'sh8013')
|
||||
response = epp_request(contact_update_xml( { chg: { email: "qwe", phone: "123qweasd" } }), :xml)
|
||||
#response = epp_request(contact_update_xml( { chg: { email: "qwe", phone: "123qweasd" } }), :xml)
|
||||
response = epp_request('contacts/update_with_errors.xml')
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2005')
|
||||
expect(response[:results][0][:msg]).to eq('Phone nr is invalid')
|
||||
|
@ -189,7 +195,8 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
end
|
||||
|
||||
it 'doesn\'t display unassociated object' do
|
||||
it 'doesn\'t display unassociated object', pending: true do
|
||||
pending 'until new contact rights systems is implemented'
|
||||
Fabricate(:contact, name:"Johnny Awesome", created_by_id: '240', code: 'info-4444')
|
||||
Fabricate(:epp_user, id: 240)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<contact:voice x="1234">+123.7035555555</contact:voice>
|
||||
<contact:fax>+1.7035555556</contact:fax>
|
||||
<contact:email>jdoe@example.com</contact:email>
|
||||
<contact:ident type="op">37605030299</contact:ident>
|
||||
<contact:ident type="passport">J836954</contact:ident>
|
||||
<contact:authInfo>
|
||||
<contact:pw>2fooBAR</contact:pw>
|
||||
</contact:authInfo>
|
||||
|
|
4
spec/fabricators/country_fabricator.rb
Normal file
4
spec/fabricators/country_fabricator.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
Fabricator(:country) do
|
||||
iso Faker::Address.state_abbr
|
||||
name Faker::Address.country
|
||||
end
|
|
@ -4,3 +4,19 @@ describe Address do
|
|||
it { should belong_to(:contact) }
|
||||
it { should belong_to(:country) }
|
||||
end
|
||||
|
||||
|
||||
describe Address, '.extract_params' do
|
||||
it 'returns params hash'do
|
||||
Fabricate(:country, iso:'EE')
|
||||
ph = { postalInfo: { name: "fred", addr: { cc: 'EE', city: 'Village', street: [ 'street1', 'street2' ] } } }
|
||||
expect(Address.extract_attributes(ph[:postalInfo][:addr])).to eq( {
|
||||
city: 'Village',
|
||||
country_id: 1,
|
||||
street: 'street1',
|
||||
street2: 'street2'
|
||||
} )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -65,6 +65,18 @@ describe Contact, '#upID' do
|
|||
end
|
||||
|
||||
|
||||
describe Contact, '.extract_params' do
|
||||
it 'returns params hash'do
|
||||
ph = { id: '123123', email: 'jdoe@example.com', postalInfo: { name: "fred", addr: { cc: 'EE' } } }
|
||||
expect(Contact.extract_attributes(ph)).to eq( {
|
||||
code: '123123',
|
||||
email: 'jdoe@example.com',
|
||||
name: 'fred'
|
||||
} )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe Contact, '.check_availability' do
|
||||
|
||||
before(:each) {
|
||||
|
|
|
@ -58,7 +58,7 @@ module EppContactXmlBuilder
|
|||
xml.tag!('contact:voice', (xml_params[:voice] || '+372.1234567')) unless xml_params[:voice] == false
|
||||
xml.tag!('contact:fax', (xml_params[:fax] || '123123' )) unless xml_params[:fax] == false
|
||||
xml.tag!('contact:email', (xml_params[:email] || 'example@test.example')) unless xml_params[:email] == false
|
||||
xml.tag!('contact:ident', (xml_params[:ident] || '37605030299')) unless xml_params[:ident] == false
|
||||
xml.tag!('contact:ident', (xml_params[:ident] || '37605030299'), type: 'op') unless xml_params[:ident] == false
|
||||
unless xml_params[:authInfo] == [false]
|
||||
xml.tag!('contact:authInfo') do
|
||||
xml.tag!('contact:pw', xml_params[:authInfo][:pw] ) unless xml_params[:authInfo][:pw] == false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue