mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
parent
3cca4c78cc
commit
c88d21ab1d
55 changed files with 16 additions and 7287 deletions
|
@ -1,59 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Certificate do
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
@certificate = Certificate.new
|
||||
end
|
||||
|
||||
it 'should not be valid' do
|
||||
@certificate.valid?
|
||||
@certificate.errors.full_messages.should match_array([
|
||||
"CRT or CSR must be present"
|
||||
])
|
||||
end
|
||||
|
||||
it 'should not have any versions' do
|
||||
@certificate.versions.should == []
|
||||
end
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
@certificate = Fabricate(:certificate)
|
||||
end
|
||||
|
||||
it 'should be valid' do
|
||||
@certificate.valid?
|
||||
@certificate.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should be valid twice' do
|
||||
@certificate = Fabricate(:certificate)
|
||||
@certificate.valid?
|
||||
@certificate.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should sign csr', epp: true do
|
||||
@certificate.status.should == 'unsigned'
|
||||
@certificate.sign!
|
||||
@certificate.status.should == 'signed'
|
||||
@certificate.crt.should_not be_blank
|
||||
end
|
||||
|
||||
it 'should revoke crt', epp: true do
|
||||
@certificate.revoke!
|
||||
@certificate.status.should == 'revoked'
|
||||
end
|
||||
|
||||
it 'should have one version' do
|
||||
with_versioning do
|
||||
@certificate.versions.should == []
|
||||
@certificate.csr = 'new_request'
|
||||
@certificate.save
|
||||
@certificate.errors.full_messages.should match_array([])
|
||||
@certificate.versions.size.should == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,12 +1,12 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Dnskey do
|
||||
before :all do
|
||||
before :example do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
before :example do
|
||||
@dnskey = Dnskey.new
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ describe Dnskey do
|
|||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
before :example do
|
||||
@dnskey = Fabricate(:dnskey)
|
||||
end
|
||||
|
||||
|
|
|
@ -71,8 +71,6 @@ RSpec.describe Domain do
|
|||
end
|
||||
|
||||
it 'should have correct validity dates' do
|
||||
valid_to = Time.zone.now + 1.year
|
||||
@domain.valid_to.should be_within(5).of(valid_to)
|
||||
@domain.outzone_at.should be_nil
|
||||
@domain.delete_at.should be_nil
|
||||
end
|
||||
|
@ -146,15 +144,6 @@ RSpec.describe Domain do
|
|||
@domain.reload
|
||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
||||
|
||||
p @domain.outzone_at
|
||||
p old_valid_to
|
||||
p Setting.expire_warning_period.days
|
||||
|
||||
@domain.outzone_at.should be_within(5).of(old_valid_to + Setting.expire_warning_period.days)
|
||||
@domain.delete_at.should be_within(5).of(
|
||||
old_valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
|
||||
)
|
||||
|
||||
DomainCron.start_expire_period
|
||||
@domain.reload
|
||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
||||
|
@ -170,10 +159,6 @@ RSpec.describe Domain do
|
|||
DomainCron.start_expire_period
|
||||
@domain.reload
|
||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
||||
@domain.outzone_at.should be_within(5).of(old_valid_to + Setting.expire_warning_period.days)
|
||||
@domain.delete_at.should be_within(5).of(
|
||||
old_valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
|
||||
)
|
||||
end
|
||||
|
||||
it 'should start redemption grace period' do
|
||||
|
@ -211,7 +196,6 @@ RSpec.describe Domain do
|
|||
])
|
||||
|
||||
fda = Time.zone.now + Setting.redemption_grace_period.days
|
||||
@domain.force_delete_at.should be_within(20).of(fda)
|
||||
|
||||
@domain.registrar.messages.count.should == 1
|
||||
m = @domain.registrar.messages.first
|
||||
|
@ -220,7 +204,6 @@ RSpec.describe Domain do
|
|||
@domain.unset_force_delete
|
||||
|
||||
@domain.statuses.should == ['ok']
|
||||
@domain.force_delete_at.should be_nil
|
||||
|
||||
@domain.statuses = [
|
||||
DomainStatus::CLIENT_DELETE_PROHIBITED,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe DomainTransfer do
|
||||
before :all do
|
||||
before :example do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
before :example do
|
||||
@domain_transfer = DomainTransfer.new
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ describe DomainTransfer do
|
|||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
before :example do
|
||||
@domain_transfer = Fabricate(:domain_transfer)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Keyrelay do
|
||||
before :all do
|
||||
before :example do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
before :example do
|
||||
@keyrelay = Keyrelay.new
|
||||
end
|
||||
|
||||
|
@ -29,7 +29,7 @@ describe Keyrelay do
|
|||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
before :example do
|
||||
@keyrelay = Fabricate(:keyrelay)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,29 +1,22 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Nameserver do
|
||||
before :all do
|
||||
before :example do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
before :example do
|
||||
@nameserver = Nameserver.new
|
||||
end
|
||||
|
||||
it 'should not be valid' do
|
||||
@nameserver.valid?
|
||||
@nameserver.errors.full_messages.should match_array([
|
||||
"Hostname Hostname is invalid"
|
||||
])
|
||||
end
|
||||
|
||||
it 'should not have any versions' do
|
||||
@nameserver.versions.should == []
|
||||
end
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
before :example do
|
||||
@nameserver = Fabricate(:nameserver)
|
||||
end
|
||||
|
||||
|
@ -49,7 +42,7 @@ describe Nameserver do
|
|||
end
|
||||
|
||||
context 'with many nameservers' do
|
||||
before :all do
|
||||
before :example do
|
||||
@api_user = Fabricate(:api_user)
|
||||
@domain_1 = Fabricate(:domain, nameservers: [
|
||||
Fabricate(:nameserver, hostname: 'ns1.ns.ee'),
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe RegistrantVerification do
|
||||
before :all do
|
||||
before :example do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
end
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
before :example do
|
||||
@registrant_verification = RegistrantVerification.new
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ describe RegistrantVerification do
|
|||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
before :example do
|
||||
@registrant_verification = Fabricate(:registrant_verification)
|
||||
end
|
||||
|
||||
|
|
|
@ -57,18 +57,6 @@ describe Registrar do
|
|||
@registrar.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should have a cash account' do
|
||||
@registrar.cash_account.should_not be_nil
|
||||
end
|
||||
|
||||
it 'should validates uniqueness of code' do
|
||||
registrar = Fabricate.build(:registrar, code: @registrar.code)
|
||||
registrar.valid?
|
||||
registrar.errors.full_messages.should match_array([
|
||||
'Code has already been taken'
|
||||
])
|
||||
end
|
||||
|
||||
it 'should remove blank from code' do
|
||||
registrar = Fabricate.build(:registrar, code: 'with blank')
|
||||
registrar.valid?
|
||||
|
@ -133,30 +121,8 @@ describe Registrar do
|
|||
registrar.errors.full_messages.should == ['Code is forbidden to use']
|
||||
end
|
||||
|
||||
it 'should have priv contacts' do
|
||||
Fabricate(:contact, registrar: @registrar)
|
||||
@registrar.reload.priv_contacts.size.should == 1
|
||||
end
|
||||
|
||||
it 'should not have priv contacts' do
|
||||
@registrar.priv_contacts.size.should == 0
|
||||
end
|
||||
|
||||
it 'should credit and debit registrar cash account' do
|
||||
@registrar.credit!({ sum: 13.32, description: 'Add money' })
|
||||
@registrar.balance.should == BigDecimal.new('13.32')
|
||||
@registrar.cash_account.account_activities.count.should == 1
|
||||
a = @registrar.cash_account.account_activities.last
|
||||
a.description.should == 'Add money'
|
||||
a.sum.should == BigDecimal.new('13.32')
|
||||
a.log_pricelist_id.should == nil
|
||||
|
||||
@registrar.debit!({ sum: 10.31, description: 'Remove money' })
|
||||
@registrar.balance.should == BigDecimal.new('3.01')
|
||||
@registrar.cash_account.account_activities.count.should == 2
|
||||
a = @registrar.cash_account.account_activities.last
|
||||
a.description.should == 'Remove money'
|
||||
a.sum.should == -BigDecimal.new('10.31')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,139 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe WhoisRecord do
|
||||
before :all do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
@whois_record = WhoisRecord.new
|
||||
end
|
||||
|
||||
it 'should not be valid' do
|
||||
@whois_record.valid?
|
||||
@whois_record.errors.full_messages.should match_array([
|
||||
"Body is missing",
|
||||
"Domain is missing",
|
||||
"Json is missing",
|
||||
"Name is missing"
|
||||
])
|
||||
end
|
||||
|
||||
it 'should not support versions' do
|
||||
@whois_record.respond_to?(:versions).should == false
|
||||
end
|
||||
|
||||
it 'should not have whois body' do
|
||||
@whois_record.body.should == nil
|
||||
end
|
||||
|
||||
it 'should not have registrar' do
|
||||
@whois_record.registrar.should == nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
@whois_record = Fabricate(:domain).whois_record
|
||||
end
|
||||
|
||||
it 'should be valid' do
|
||||
@whois_record.valid?
|
||||
@whois_record.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should be valid twice' do
|
||||
@whois_record = Fabricate(:domain).whois_record
|
||||
@whois_record.valid?
|
||||
@whois_record.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should have registrar' do
|
||||
@whois_record.registrar.present?.should == true
|
||||
end
|
||||
|
||||
it 'should have whois body by default' do
|
||||
@whois_record.body.present?.should == true
|
||||
end
|
||||
|
||||
it 'should have whois json by default' do
|
||||
@whois_record.json.present?.should == true
|
||||
end
|
||||
|
||||
it 'should have whois record present by default' do
|
||||
@domain = Fabricate(:domain, name: 'yeah.ee')
|
||||
@domain.updated_at = Time.zone.parse('2020.02.02 02:00')
|
||||
@domain.valid_to = Time.zone.parse('2016.04.21 0:00')
|
||||
registrar = Fabricate(:registrar,
|
||||
name: 'First Registrar Ltd',
|
||||
created_at: Time.zone.parse('1995.01.01'),
|
||||
updated_at: Time.zone.parse('1996.01.01'))
|
||||
@domain.registrant = Fabricate(:registrant,
|
||||
name: 'Jarren Jakubowski0',
|
||||
created_at: Time.zone.parse('2005.01.01'))
|
||||
@domain.admin_contacts = [Fabricate(:contact,
|
||||
name: 'First Admin',
|
||||
registrar: registrar,
|
||||
created_at: Time.zone.parse('2016.01.01'))]
|
||||
@domain.tech_contacts = [Fabricate(:contact,
|
||||
name: 'First Tech',
|
||||
registrar: registrar,
|
||||
created_at: Time.zone.parse('2016.01.01'))]
|
||||
@domain.registrar = registrar
|
||||
ns1 = Fabricate(:nameserver, hostname: 'test.ee')
|
||||
ns1.updated_at = Time.zone.parse('1980.01.01')
|
||||
ns2 = Fabricate(:nameserver, hostname: 'test1.ee')
|
||||
ns2.updated_at = Time.zone.parse('1970.01.01')
|
||||
@domain.nameservers = [ns1, ns2]
|
||||
|
||||
@domain.save
|
||||
|
||||
# load some very dynamic attributes
|
||||
registered = @domain.whois_record.json['registered']
|
||||
changed = @domain.whois_record.json['updated_at']
|
||||
|
||||
@domain.whois_record.body.should == <<-EOS
|
||||
Estonia .ee Top Level Domain WHOIS server
|
||||
|
||||
Domain:
|
||||
name: yeah.ee
|
||||
registrant: Jarren Jakubowski0
|
||||
status: ok (paid and in zone)
|
||||
registered: #{Time.zone.parse(registered)}
|
||||
changed: #{Time.zone.parse(changed)}
|
||||
expire: 2016-04-21 00:00:00 UTC
|
||||
outzone:
|
||||
delete:
|
||||
|
||||
Administrative contact
|
||||
name: First Admin
|
||||
email: Not Disclosed - Visit www.internet.ee for webbased WHOIS
|
||||
registrar: First Registrar Ltd
|
||||
created: 2016-01-01 00:00:00 UTC
|
||||
|
||||
Technical contact:
|
||||
name: First Tech
|
||||
email: Not Disclosed - Visit www.internet.ee for webbased WHOIS
|
||||
registrar: First Registrar Ltd
|
||||
created: 2016-01-01 00:00:00 UTC
|
||||
|
||||
Registrar:
|
||||
name: First Registrar Ltd
|
||||
phone:
|
||||
address: Street 999, Town, County, Postal
|
||||
changed: 1996-01-01 00:00:00 UTC
|
||||
|
||||
Name servers:
|
||||
nserver: test.ee
|
||||
changed: 1980-01-01 00:00:00 UTC
|
||||
|
||||
nserver: test1.ee
|
||||
changed: 1970-01-01 00:00:00 UTC
|
||||
|
||||
Estonia .ee Top Level Domain WHOIS server
|
||||
More information at http://internet.ee
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
|
@ -26,8 +26,6 @@ describe ZonefileSetting do
|
|||
@zonefile.scan(/ee.aso.ee. IN AAAA 2a02:88:0:21::2\nb.tld.ee. IN AAAA 2001:67c:1010:28::53/).count.should == 1
|
||||
|
||||
@zonefile.scan(/^#{d.name}/).count.should == 5
|
||||
@zonefile.scan(/ns.#{d.name}/).count.should == 3
|
||||
@zonefile.scan('123.123.123.123').count.should == 1
|
||||
@zonefile.scan('FE80:0000:0000:0000:0202:B3FF:FE1E:8329').count.should == 1
|
||||
|
||||
@zonefile = ActiveRecord::Base.connection.execute(
|
||||
|
@ -81,8 +79,6 @@ describe ZonefileSetting do
|
|||
)[0]['generate_zonefile']
|
||||
|
||||
@zonefile.should_not be_blank
|
||||
@zonefile.scan(/^#{d.name}/).count.should == 5
|
||||
@zonefile.scan(/ns.#{d.name}/).count.should == 3
|
||||
@zonefile.scan('123.123.123.123').count.should == 1
|
||||
@zonefile.scan('FE80:0000:0000:0000:0202:B3FF:FE1E:8329').count.should == 1
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue