mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +02:00
Merge branch 'master' of github.com:internetee/registry
This commit is contained in:
commit
0a2ed60b9e
11 changed files with 50 additions and 46 deletions
|
@ -34,7 +34,6 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
expect(Contact.count).to eq(1)
|
||||
|
||||
|
||||
expect(Contact.first.international_address.org_name).to eq('Example Inc.')
|
||||
expect(Contact.first.ident).to eq '37605030299'
|
||||
expect(Contact.first.ident_type).to eq 'op'
|
||||
|
@ -62,11 +61,11 @@ describe 'EPP Contact', epp: true do
|
|||
expect(response[:msg]).to eq('Command completed successfully')
|
||||
|
||||
id = response[:parsed].css('resData creData id').first
|
||||
crDate = response[:parsed].css('resData creData crDate').first
|
||||
cr_date = response[:parsed].css('resData creData crDate').first
|
||||
|
||||
expect(id.text).to eq('sh8013')
|
||||
# 5 seconds for what-ever weird lag reasons might happen
|
||||
expect(crDate.text.to_time).to be_within(5).of(Time.now)
|
||||
expect(cr_date.text.to_time).to be_within(5).of(Time.now)
|
||||
|
||||
end
|
||||
|
||||
|
@ -75,7 +74,6 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
response = epp_request(contact_create_xml, :xml)
|
||||
|
||||
|
||||
expect(response[:result_code]).to eq('2302')
|
||||
expect(response[:msg]).to eq('Contact id already exists')
|
||||
|
||||
|
@ -107,14 +105,13 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
expect(Contact.first.updated_by_id).to be nil
|
||||
|
||||
response = epp_request(contact_update_xml, :xml)
|
||||
epp_request(contact_update_xml, :xml)
|
||||
|
||||
expect(Contact.first.updated_by_id).to eq 1
|
||||
end
|
||||
|
||||
it 'is succesful' do
|
||||
Fabricate(:contact, created_by_id: 1, email: 'not_updated@test.test', code: 'sh8013', auth_info: '2fooBAR')
|
||||
# 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')
|
||||
|
@ -218,7 +215,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'returns info about contact' do
|
||||
Fabricate(:contact, created_by_id: '1', code: 'info-4444', auth_info: '2fooBAR',
|
||||
Fabricate(:contact, created_by_id: '1', code: 'info-4444', auth_info: '2fooBAR',
|
||||
international_address: Fabricate(:international_address, name: 'Johnny Awesome'))
|
||||
|
||||
response = epp_request('contacts/info.xml')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Fabricator(:international_address) do
|
||||
name Faker::Name.name
|
||||
city Faker::Address.city
|
||||
street Faker::Address.street_name
|
||||
name Faker::Name.name
|
||||
city Faker::Address.city
|
||||
street Faker::Address.street_name
|
||||
street2 Faker::Address.street_name
|
||||
zip Faker::Address.zip
|
||||
end
|
||||
|
|
|
@ -7,16 +7,16 @@ 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])).to eq( {
|
||||
Fabricate(:country, iso: 'EE')
|
||||
ph = { postalInfo: { name: 'fred', addr: { cc: 'EE', city: 'Village', street: %w(street1 street2) } } }
|
||||
expect(Address.extract_attributes(ph[:postalInfo])).to eq({
|
||||
international_address_attributes: {
|
||||
name: 'fred',
|
||||
city: 'Village',
|
||||
country_id: 1,
|
||||
street: 'street1',
|
||||
street2: 'street2',
|
||||
}
|
||||
street2: 'street2'
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -59,27 +59,29 @@ describe Contact, '#relations_with_domain?' do
|
|||
end
|
||||
end
|
||||
|
||||
describe Contact, '#crID' do
|
||||
describe Contact, '#cr_id' do
|
||||
before(:each) { Fabricate(:contact, code: 'asd12', created_by: Fabricate(:epp_user)) }
|
||||
|
||||
it 'should return username of creator' do
|
||||
expect(Contact.first.crID).to eq('gitlab')
|
||||
expect(Contact.first.cr_id).to eq('gitlab')
|
||||
end
|
||||
|
||||
it 'should return nil when no creator' do
|
||||
expect(Contact.new.crID).to be nil
|
||||
expect(Contact.new.cr_id).to be nil
|
||||
end
|
||||
end
|
||||
|
||||
describe Contact, '#upID' do
|
||||
before(:each) { Fabricate(:contact, code: 'asd12', created_by: Fabricate(:epp_user), updated_by: Fabricate(:epp_user)) }
|
||||
describe Contact, '#up_id' do
|
||||
before(:each) do
|
||||
Fabricate(:contact, code: 'asd12', created_by: Fabricate(:epp_user), updated_by: Fabricate(:epp_user))
|
||||
end
|
||||
|
||||
it 'should return username of updater' do
|
||||
expect(Contact.first.upID).to eq('gitlab')
|
||||
expect(Contact.first.up_id).to eq('gitlab')
|
||||
end
|
||||
|
||||
it 'should return nil when no updater' do
|
||||
expect(Contact.new.upID).to be nil
|
||||
expect(Contact.new.up_id).to be nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -89,7 +91,7 @@ describe Contact, '.extract_params' do
|
|||
expect(Contact.extract_attributes(ph)).to eq({
|
||||
code: '123123',
|
||||
email: 'jdoe@example.com'
|
||||
} )
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue