mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 01:36:02 +02:00
Rubocop autocorrect
This commit is contained in:
parent
f8c48a7456
commit
6c5c0b38c8
59 changed files with 533 additions and 546 deletions
|
@ -1,17 +1,17 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe 'EPP Contact', epp: true do
|
||||
let(:server) { Epp::Server.new({server: 'localhost', tag: 'gitlab', password: 'ghyt9e4fu', port: 701}) }
|
||||
let(:server) { Epp::Server.new({ server: 'localhost', tag: 'gitlab', password: 'ghyt9e4fu', port: 701 }) }
|
||||
|
||||
context 'with valid user' do
|
||||
before(:each) {
|
||||
Fabricate(:epp_user)
|
||||
Fabricate(:domain_validation_setting_group)
|
||||
}
|
||||
before(:each) do
|
||||
Fabricate(:epp_user)
|
||||
Fabricate(:domain_validation_setting_group)
|
||||
end
|
||||
context 'create command' do
|
||||
|
||||
it "fails if request is invalid" do
|
||||
response = epp_request(contact_create_xml( { authInfo: [false], addr: { cc: false, city: false } } ), :xml)
|
||||
it 'fails if request is invalid' do
|
||||
response = epp_request(contact_create_xml({ authInfo: [false], addr: { cc: false, city: false } }), :xml)
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2003')
|
||||
expect(response[:results][1][:result_code]).to eq('2003')
|
||||
|
@ -52,7 +52,7 @@ describe 'EPP Contact', epp: true do
|
|||
crDate = response[:parsed].css('resData creData crDate').first
|
||||
|
||||
expect(id.text).to eq('sh8013')
|
||||
#5 seconds for what-ever weird lag reasons might happen
|
||||
# 5 seconds for what-ever weird lag reasons might happen
|
||||
expect(crDate.text.to_time).to be_within(5).of(Time.now)
|
||||
|
||||
end
|
||||
|
@ -69,18 +69,16 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
context 'update command' do
|
||||
it "fails if request is invalid" 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(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')
|
||||
expect(response[:results].count).to eq 1
|
||||
end
|
||||
|
||||
|
||||
it 'fails with wrong authentication info' do
|
||||
Fabricate(:contact, code: 'sh8013', auth_info: 'secure_password')
|
||||
|
||||
|
@ -102,7 +100,7 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
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(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')
|
||||
|
@ -114,7 +112,7 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
it 'returns phone and email error' 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: "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')
|
||||
|
@ -126,7 +124,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
context 'delete command' do
|
||||
it "fails if request is invalid" do
|
||||
it 'fails if request is invalid' do
|
||||
response = epp_request('contacts/delete_missing_attr.xml')
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2003')
|
||||
|
@ -135,7 +133,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'deletes contact' do
|
||||
Fabricate(:contact, code: "dwa1234")
|
||||
Fabricate(:contact, code: 'dwa1234')
|
||||
response = epp_request('contacts/delete.xml')
|
||||
expect(response[:result_code]).to eq('1000')
|
||||
expect(response[:msg]).to eq('Command completed successfully')
|
||||
|
@ -163,10 +161,9 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
context 'check command' do
|
||||
it "fails if request is invalid" do
|
||||
response = epp_request(contact_check_xml( ids: [ false ] ), :xml)
|
||||
it 'fails if request is invalid' do
|
||||
response = epp_request(contact_check_xml(ids: [false]), :xml)
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2003')
|
||||
expect(response[:results][0][:msg]).to eq('Required parameter missing: id')
|
||||
|
@ -176,7 +173,7 @@ describe 'EPP Contact', epp: true do
|
|||
it 'returns info about contact availability' do
|
||||
Fabricate(:contact, code: 'check-1234')
|
||||
|
||||
response = epp_request(contact_check_xml( ids: [{ id: 'check-1234'}, { id: 'check-4321' }] ), :xml)
|
||||
response = epp_request(contact_check_xml(ids: [{ id: 'check-1234' }, { id: 'check-4321' }]), :xml)
|
||||
|
||||
expect(response[:result_code]).to eq('1000')
|
||||
expect(response[:msg]).to eq('Command completed successfully')
|
||||
|
@ -191,7 +188,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
context 'info command' do
|
||||
it "fails if request invalid" do
|
||||
it 'fails if request invalid' do
|
||||
response = epp_request('contacts/delete_missing_attr.xml')
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2003')
|
||||
|
@ -207,7 +204,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'returns info about contact' do
|
||||
Fabricate(:contact, name: "Johnny Awesome", created_by_id: '1', code: 'info-4444', auth_info: '2fooBAR')
|
||||
Fabricate(:contact, name: 'Johnny Awesome', created_by_id: '1', code: 'info-4444', auth_info: '2fooBAR')
|
||||
Fabricate(:address)
|
||||
|
||||
response = epp_request('contacts/info.xml')
|
||||
|
@ -220,7 +217,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'doesn\'t display unassociated object' do
|
||||
Fabricate(:contact, name:"Johnny Awesome", code: 'info-4444')
|
||||
Fabricate(:contact, name: 'Johnny Awesome', code: 'info-4444')
|
||||
|
||||
response = epp_request('contacts/info.xml')
|
||||
expect(response[:result_code]).to eq('2201')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe 'EPP Domain', epp: true do
|
||||
let(:server) { server = Epp::Server.new({server: 'localhost', tag: 'gitlab', password: 'ghyt9e4fu', port: 701}) }
|
||||
let(:server) { server = Epp::Server.new({ server: 'localhost', tag: 'gitlab', password: 'ghyt9e4fu', port: 701 }) }
|
||||
|
||||
context 'with valid user' do
|
||||
before(:each) do
|
||||
|
@ -30,11 +30,11 @@ describe 'EPP Domain', epp: true do
|
|||
end
|
||||
|
||||
context 'with citizen as an owner' do
|
||||
before(:each) {
|
||||
before(:each) do
|
||||
Fabricate(:contact, code: 'jd1234')
|
||||
Fabricate(:contact, code: 'sh8013')
|
||||
Fabricate(:contact, code: 'sh801333')
|
||||
}
|
||||
end
|
||||
|
||||
it 'creates a domain' do
|
||||
response = epp_request(domain_create_xml, :xml)
|
||||
|
@ -88,7 +88,7 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
it 'does not create domain with too many nameservers' do
|
||||
nameservers = []
|
||||
14.times {|i| nameservers << {hostObj: "ns#{i}.example.net"}}
|
||||
14.times { |i| nameservers << { hostObj: "ns#{i}.example.net" } }
|
||||
xml = domain_create_xml(nameservers: nameservers)
|
||||
|
||||
response = epp_request(xml, :xml)
|
||||
|
@ -97,7 +97,7 @@ describe 'EPP Domain', epp: true do
|
|||
end
|
||||
|
||||
it 'returns error when invalid nameservers are present' do
|
||||
xml = domain_create_xml(nameservers: [{hostObj: 'invalid1-'}, {hostObj: '-invalid2'}])
|
||||
xml = domain_create_xml(nameservers: [{ hostObj: 'invalid1-' }, { hostObj: '-invalid2' }])
|
||||
|
||||
response = epp_request(xml, :xml)
|
||||
expect(response[:result_code]).to eq('2005')
|
||||
|
@ -144,14 +144,14 @@ describe 'EPP Domain', epp: true do
|
|||
end
|
||||
|
||||
context 'with juridical persion as an owner' do
|
||||
before(:each) {
|
||||
before(:each) do
|
||||
Fabricate(:contact, code: 'jd1234', ident_type: 'ico')
|
||||
Fabricate(:contact, code: 'sh8013')
|
||||
Fabricate(:contact, code: 'sh801333')
|
||||
}
|
||||
end
|
||||
|
||||
it 'creates a domain with contacts' do
|
||||
xml = domain_create_xml(contacts: [{contact_value: 'sh8013', contact_type: 'admin'}])
|
||||
xml = domain_create_xml(contacts: [{ contact_value: 'sh8013', contact_type: 'admin' }])
|
||||
|
||||
response = epp_request(xml, :xml)
|
||||
expect(response[:result_code]).to eq('1000')
|
||||
|
@ -166,7 +166,7 @@ describe 'EPP Domain', epp: true do
|
|||
end
|
||||
|
||||
it 'does not create a domain without admin contact' do
|
||||
xml = domain_create_xml(contacts: [{contact_value: 'sh8013', contact_type: 'tech'}])
|
||||
xml = domain_create_xml(contacts: [{ contact_value: 'sh8013', contact_type: 'tech' }])
|
||||
|
||||
response = epp_request(xml, :xml)
|
||||
expect(response[:result_code]).to eq('2306')
|
||||
|
@ -217,12 +217,12 @@ describe 'EPP Domain', epp: true do
|
|||
expect(inf_data.css('name').text).to eq('example.ee')
|
||||
expect(inf_data.css('registrant').text).to eq(d.owner_contact_code)
|
||||
|
||||
admin_contacts_from_request = inf_data.css('contact[type="admin"]').collect{|x| x.text }
|
||||
admin_contacts_from_request = inf_data.css('contact[type="admin"]').map { |x| x.text }
|
||||
admin_contacts_existing = d.admin_contacts.pluck(:code)
|
||||
|
||||
expect(admin_contacts_from_request).to eq(admin_contacts_existing)
|
||||
|
||||
hosts_from_request = inf_data.css('hostObj').collect{|x| x.text }
|
||||
hosts_from_request = inf_data.css('hostObj').map { |x| x.text }
|
||||
hosts_existing = d.nameservers.pluck(:hostname)
|
||||
|
||||
expect(hosts_from_request).to eq(hosts_existing)
|
||||
|
|
|
@ -64,12 +64,12 @@ describe 'EPP Helper', epp: true do
|
|||
name: 'one.ee',
|
||||
period_value: '345',
|
||||
period_unit: 'd',
|
||||
nameservers: [{hostObj: 'ns1.test.net'}, {hostObj: 'ns2.test.net'}],
|
||||
nameservers: [{ hostObj: 'ns1.test.net' }, { hostObj: 'ns2.test.net' }],
|
||||
registrant: '32fsdaf',
|
||||
contacts: [
|
||||
{contact_value: '2323rafaf', contact_type: 'admin'},
|
||||
{contact_value: '3dgxx', contact_type: 'tech'},
|
||||
{contact_value: '345xxv', contact_type: 'tech'}
|
||||
{ contact_value: '2323rafaf', contact_type: 'admin' },
|
||||
{ contact_value: '3dgxx', contact_type: 'tech' },
|
||||
{ contact_value: '345xxv', contact_type: 'tech' }
|
||||
],
|
||||
pw: 'sdgdgd4esfsa'
|
||||
)
|
||||
|
@ -124,7 +124,6 @@ describe 'EPP Helper', epp: true do
|
|||
</epp>
|
||||
').to_s.squish
|
||||
|
||||
|
||||
generated = Nokogiri::XML(domain_info_xml).to_s.squish
|
||||
expect(generated).to eq(expected)
|
||||
|
||||
|
@ -145,7 +144,6 @@ describe 'EPP Helper', epp: true do
|
|||
</epp>
|
||||
').to_s.squish
|
||||
|
||||
|
||||
generated = Nokogiri::XML(domain_info_xml(name_value: 'one.ee', name_hosts: 'sub', pw: 'b3rafsla')).to_s.squish
|
||||
expect(generated).to eq(expected)
|
||||
end
|
||||
|
@ -165,7 +163,6 @@ describe 'EPP Helper', epp: true do
|
|||
</epp>
|
||||
').to_s.squish
|
||||
|
||||
|
||||
generated = Nokogiri::XML(domain_check_xml).to_s.squish
|
||||
expect(generated).to eq(expected)
|
||||
|
||||
|
@ -185,7 +182,6 @@ describe 'EPP Helper', epp: true do
|
|||
</epp>
|
||||
').to_s.squish
|
||||
|
||||
|
||||
generated = Nokogiri::XML(domain_check_xml(names: ['example.ee', 'example2.ee', 'example3.ee'])).to_s.squish
|
||||
expect(generated).to eq(expected)
|
||||
end
|
||||
|
@ -207,7 +203,6 @@ describe 'EPP Helper', epp: true do
|
|||
</epp>
|
||||
').to_s.squish
|
||||
|
||||
|
||||
generated = Nokogiri::XML(domain_renew_xml).to_s.squish
|
||||
expect(generated).to eq(expected)
|
||||
|
||||
|
@ -227,7 +222,6 @@ describe 'EPP Helper', epp: true do
|
|||
</epp>
|
||||
').to_s.squish
|
||||
|
||||
|
||||
generated = Nokogiri::XML(domain_renew_xml(name: 'one.ee', curExpDate: '2009-11-15', period_value: '365', period_unit: 'd')).to_s.squish
|
||||
expect(generated).to eq(expected)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe 'EPP Session', epp: true do
|
||||
let(:server) { server = Epp::Server.new({server: 'localhost', tag: 'gitlab', password: 'ghyt9e4fu', port: 701}) }
|
||||
let(:server) { server = Epp::Server.new({ server: 'localhost', tag: 'gitlab', password: 'ghyt9e4fu', port: 701 }) }
|
||||
|
||||
context 'when not connected' do
|
||||
it 'greets client upon connection' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue