mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +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
|
||||
|
||||
it 'does not log in twice' do
|
||||
ApiLog::EppLog.delete_all
|
||||
epp_plain_request(@login_xml_cache, :xml)
|
||||
response = 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[:msg].should match(/Already logged in. Use/)
|
||||
response[:result_code].should == '2002'
|
||||
|
||||
log = ApiLog::EppLog.all
|
||||
log.length.should == 2
|
||||
|
||||
log[0].request_command.should == 'login'
|
||||
log[0].request_successful.should == true
|
||||
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Ü'
|
||||
log = ApiLog::EppLog.last
|
||||
log.request_command.should == 'login'
|
||||
log.request_successful.should == false
|
||||
log.api_user_name.should == 'gitlab'
|
||||
log.api_user_registrar.should == 'Registrar OÜ'
|
||||
end
|
||||
|
||||
it 'logs out epp user' do
|
||||
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[:msg].should == 'Command completed successfully; ending session'
|
||||
response[:result_code].should == '1500'
|
||||
|
||||
EppSession.first[:epp_user_id].should == nil
|
||||
EppSession.last[:epp_user_id].should == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -81,6 +81,11 @@ describe Contact do
|
|||
end
|
||||
|
||||
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') }
|
||||
|
||||
context 'after create' do
|
||||
|
|
|
@ -15,52 +15,52 @@ describe Domain do
|
|||
create_settings
|
||||
end
|
||||
|
||||
it 'validates domain name', skip: true do
|
||||
d = Fabricate(:domain)
|
||||
expect(d.name).to_not be_nil
|
||||
# it 'validates domain name', skip: true do
|
||||
# d = Fabricate(:domain)
|
||||
# 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',
|
||||
'õ.pri.ee', 'test.com', 'www.ab.ee', 'test.eu', ' .ee', 'a b.ee', 'Ž .ee', 'test.edu.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']
|
||||
|
||||
invalid.each do |x|
|
||||
expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||
end
|
||||
# invalid.each do |x|
|
||||
# expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||
# end
|
||||
|
||||
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 ']
|
||||
# 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 ']
|
||||
|
||||
valid.each do |x|
|
||||
expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||
end
|
||||
# valid.each do |x|
|
||||
# expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||
# end
|
||||
|
||||
invalid_punycode = ['xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-4we.pri.ee']
|
||||
# invalid_punycode = ['xn--geaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-4we.pri.ee']
|
||||
|
||||
invalid_punycode.each do |x|
|
||||
expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||
end
|
||||
# invalid_punycode.each do |x|
|
||||
# expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||
# 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|
|
||||
expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||
end
|
||||
# valid_punycode.each do |x|
|
||||
# expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||
# end
|
||||
|
||||
d = Domain.new
|
||||
expect(d.valid?).to be false
|
||||
expect(d.errors.messages).to match_array({
|
||||
owner_contact: ['Registrant is missing'],
|
||||
admin_contacts: ['Admin contacts count must be between 1 - infinity'],
|
||||
nameservers: ['Nameservers count must be between 2-11'],
|
||||
registrar: ['Registrar is missing'],
|
||||
period: ['Period is not a number']
|
||||
})
|
||||
# d = Domain.new
|
||||
# expect(d.valid?).to be false
|
||||
# expect(d.errors.messages).to match_array({
|
||||
# owner_contact: ['Registrant is missing'],
|
||||
# admin_contacts: ['Admin contacts count must be between 1 - infinity'],
|
||||
# nameservers: ['Nameservers count must be between 2-11'],
|
||||
# registrar: ['Registrar is missing'],
|
||||
# period: ['Period is not a number']
|
||||
# })
|
||||
|
||||
Setting.ns_min_count = 2
|
||||
Setting.ns_max_count = 7
|
||||
# Setting.ns_min_count = 2
|
||||
# Setting.ns_max_count = 7
|
||||
|
||||
expect(d.valid?).to be false
|
||||
expect(d.errors.messages[:nameservers]).to eq(['Nameservers count must be between 2-7'])
|
||||
end
|
||||
# expect(d.valid?).to be false
|
||||
# expect(d.errors.messages[:nameservers]).to eq(['Nameservers count must be between 2-7'])
|
||||
# end
|
||||
|
||||
it 'downcases domain' do
|
||||
d = Domain.new(name: 'TesT.Ee')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue