mirror of
https://github.com/internetee/registry.git
synced 2025-07-02 01:03:35 +02:00
Merge branch 'faster-spec' of github.com:domify/registry into faster-spec
This commit is contained in:
commit
61cf340f8f
3 changed files with 52 additions and 51 deletions
|
@ -54,35 +54,31 @@ describe 'EPP Session', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not log in twice' do
|
it 'does not log in twice' do
|
||||||
ApiLog::EppLog.delete_all
|
response = epp_plain_request(@login_xml_cache, :xml)
|
||||||
epp_plain_request(@login_xml_cache, :xml)
|
response[:msg].should == 'Command completed successfully'
|
||||||
|
response[:result_code].should == '1000'
|
||||||
|
response[:clTRID].should == 'ABC-12345'
|
||||||
|
|
||||||
response = epp_plain_request(@login_xml_cache, :xml)
|
response = epp_plain_request(@login_xml_cache, :xml)
|
||||||
response[:msg].should match(/Already logged in. Use/)
|
response[:msg].should match(/Already logged in. Use/)
|
||||||
response[:result_code].should == '2002'
|
response[:result_code].should == '2002'
|
||||||
|
|
||||||
log = ApiLog::EppLog.all
|
log = ApiLog::EppLog.last
|
||||||
log.length.should == 2
|
log.request_command.should == 'login'
|
||||||
|
log.request_successful.should == false
|
||||||
log[0].request_command.should == 'login'
|
log.api_user_name.should == 'gitlab'
|
||||||
log[0].request_successful.should == true
|
log.api_user_registrar.should == 'Registrar OÜ'
|
||||||
log[0].api_user_name.should == 'gitlab'
|
|
||||||
log[0].api_user_registrar.should == 'Registrar OÜ'
|
|
||||||
|
|
||||||
log[1].request_command.should == 'login'
|
|
||||||
log[1].request_successful.should == false
|
|
||||||
log[1].api_user_name.should == 'gitlab'
|
|
||||||
log[1].api_user_registrar.should == 'Registrar OÜ'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'logs out epp user' do
|
it 'logs out epp user' do
|
||||||
epp_plain_request(@login_xml_cache, :xml)
|
epp_plain_request(@login_xml_cache, :xml)
|
||||||
|
|
||||||
EppSession.first[:epp_user_id].should == 1
|
EppSession.last[:epp_user_id].should == 1
|
||||||
response = epp_plain_request(@epp_xml.session.logout, :xml)
|
response = epp_plain_request(@epp_xml.session.logout, :xml)
|
||||||
response[:msg].should == 'Command completed successfully; ending session'
|
response[:msg].should == 'Command completed successfully; ending session'
|
||||||
response[:result_code].should == '1500'
|
response[:result_code].should == '1500'
|
||||||
|
|
||||||
EppSession.first[:epp_user_id].should == nil
|
EppSession.last[:epp_user_id].should == nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -81,6 +81,11 @@ describe Contact do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with callbacks' do
|
context 'with callbacks' do
|
||||||
|
before :all do
|
||||||
|
Contact.set_callback(:create, :before, :generate_code)
|
||||||
|
Contact.set_callback(:create, :before, :generate_auth_info)
|
||||||
|
end
|
||||||
|
|
||||||
before(:each) { @contact = Fabricate.build(:contact, code: '123asd', auth_info: 'qwe321') }
|
before(:each) { @contact = Fabricate.build(:contact, code: '123asd', auth_info: 'qwe321') }
|
||||||
|
|
||||||
context 'after create' do
|
context 'after create' do
|
||||||
|
|
|
@ -15,52 +15,52 @@ describe Domain do
|
||||||
create_settings
|
create_settings
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'validates domain name', skip: true do
|
# it 'validates domain name', skip: true do
|
||||||
d = Fabricate(:domain)
|
# d = Fabricate(:domain)
|
||||||
expect(d.name).to_not be_nil
|
# expect(d.name).to_not be_nil
|
||||||
|
|
||||||
invalid = ['a.ee', "#{'a' * 64}.ee", 'ab.eu', 'test.ab.ee', '-test.ee', '-test-.ee', 'test-.ee', 'te--st.ee',
|
# invalid = ['a.ee', "#{'a' * 64}.ee", 'ab.eu', 'test.ab.ee', '-test.ee', '-test-.ee', 'test-.ee', 'te--st.ee',
|
||||||
'õ.pri.ee', 'test.com', 'www.ab.ee', 'test.eu', ' .ee', 'a b.ee', 'Ž .ee', 'test.edu.ee']
|
# 'õ.pri.ee', 'test.com', 'www.ab.ee', 'test.eu', ' .ee', 'a b.ee', 'Ž .ee', 'test.edu.ee']
|
||||||
|
|
||||||
invalid.each do |x|
|
# invalid.each do |x|
|
||||||
expect(Fabricate.build(:domain, name: x).valid?).to be false
|
# expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||||
end
|
# end
|
||||||
|
|
||||||
valid = ['ab.ee', "#{'a' * 63}.ee", 'te-s-t.ee', 'jäääär.ee', 'päike.pri.ee',
|
# valid = ['ab.ee', "#{'a' * 63}.ee", 'te-s-t.ee', 'jäääär.ee', 'päike.pri.ee',
|
||||||
'õigus.com.ee', 'õäöü.fie.ee', 'test.med.ee', 'žä.ee', ' ŽŠ.ee ']
|
# 'õigus.com.ee', 'õäöü.fie.ee', 'test.med.ee', 'žä.ee', ' ŽŠ.ee ']
|
||||||
|
|
||||||
valid.each do |x|
|
# valid.each do |x|
|
||||||
expect(Fabricate.build(:domain, name: x).valid?).to be true
|
# expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||||
end
|
# end
|
||||||
|
|
||||||
invalid_punycode = ['xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-4we.pri.ee']
|
# invalid_punycode = ['xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-4we.pri.ee']
|
||||||
|
|
||||||
invalid_punycode.each do |x|
|
# invalid_punycode.each do |x|
|
||||||
expect(Fabricate.build(:domain, name: x).valid?).to be false
|
# expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||||
end
|
# end
|
||||||
|
|
||||||
valid_punycode = ['xn--ge-uia.pri.ee', 'xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-9te.pri.ee']
|
# valid_punycode = ['xn--ge-uia.pri.ee', 'xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-9te.pri.ee']
|
||||||
|
|
||||||
valid_punycode.each do |x|
|
# valid_punycode.each do |x|
|
||||||
expect(Fabricate.build(:domain, name: x).valid?).to be true
|
# expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||||
end
|
# end
|
||||||
|
|
||||||
d = Domain.new
|
# d = Domain.new
|
||||||
expect(d.valid?).to be false
|
# expect(d.valid?).to be false
|
||||||
expect(d.errors.messages).to match_array({
|
# expect(d.errors.messages).to match_array({
|
||||||
owner_contact: ['Registrant is missing'],
|
# owner_contact: ['Registrant is missing'],
|
||||||
admin_contacts: ['Admin contacts count must be between 1 - infinity'],
|
# admin_contacts: ['Admin contacts count must be between 1 - infinity'],
|
||||||
nameservers: ['Nameservers count must be between 2-11'],
|
# nameservers: ['Nameservers count must be between 2-11'],
|
||||||
registrar: ['Registrar is missing'],
|
# registrar: ['Registrar is missing'],
|
||||||
period: ['Period is not a number']
|
# period: ['Period is not a number']
|
||||||
})
|
# })
|
||||||
|
|
||||||
Setting.ns_min_count = 2
|
# Setting.ns_min_count = 2
|
||||||
Setting.ns_max_count = 7
|
# Setting.ns_max_count = 7
|
||||||
|
|
||||||
expect(d.valid?).to be false
|
# expect(d.valid?).to be false
|
||||||
expect(d.errors.messages[:nameservers]).to eq(['Nameservers count must be between 2-7'])
|
# expect(d.errors.messages[:nameservers]).to eq(['Nameservers count must be between 2-7'])
|
||||||
end
|
# end
|
||||||
|
|
||||||
it 'downcases domain' do
|
it 'downcases domain' do
|
||||||
d = Domain.new(name: 'TesT.Ee')
|
d = Domain.new(name: 'TesT.Ee')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue