mirror of
https://github.com/internetee/registry.git
synced 2025-05-28 16:39:55 +02:00
Story#110308584 - update domain tests with last codebase
This commit is contained in:
parent
0cd0a2ebae
commit
4739e19d63
4 changed files with 28 additions and 15 deletions
1
Gemfile
1
Gemfile
|
@ -141,6 +141,7 @@ group :development, :test do
|
|||
gem 'fabrication', '2.13.2' # Replacement for fixtures
|
||||
gem 'shoulda-matchers', '2.8.0', require: false # Additional matchers for RSpec
|
||||
gem 'launchy', '2.4.3' # for opening browser automatically
|
||||
gem 'que-testing'
|
||||
|
||||
# helper gems
|
||||
gem 'database_cleaner', '1.4.1' # For cleaning db in feature and epp tests
|
||||
|
|
|
@ -357,6 +357,8 @@ GEM
|
|||
method_source (~> 0.8.1)
|
||||
slop (~> 3.4)
|
||||
que (0.10.0)
|
||||
que-testing (0.1.1)
|
||||
que
|
||||
que-web (0.4.0)
|
||||
erubis
|
||||
que (~> 0.8)
|
||||
|
@ -624,6 +626,7 @@ DEPENDENCIES
|
|||
poltergeist (= 1.6.0)
|
||||
pry (= 0.10.1)
|
||||
que (= 0.10.0)
|
||||
que-testing
|
||||
que-web (= 0.4.0)
|
||||
que_mailer!
|
||||
railroady (= 1.3.0)
|
||||
|
@ -654,4 +657,4 @@ DEPENDENCIES
|
|||
whenever (= 0.9.4)
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
1.11.2
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Fabricator(:reserved_domain) do
|
||||
names { { '1162.ee': 'abc' } }
|
||||
name '1162.ee'
|
||||
password 'abc'
|
||||
end
|
||||
|
|
|
@ -110,10 +110,12 @@ describe Domain do
|
|||
end
|
||||
|
||||
it 'should have whois body by default' do
|
||||
@domain.run_callbacks(:commit)
|
||||
@domain.whois_record.present?.should == true
|
||||
end
|
||||
|
||||
it 'should have whois json by default' do
|
||||
@domain.run_callbacks(:commit)
|
||||
@domain.whois_record.json.present?.should == true
|
||||
end
|
||||
|
||||
|
@ -122,7 +124,7 @@ describe Domain do
|
|||
end
|
||||
|
||||
it 'should not find any domain pendings to clean' do
|
||||
Domain.clean_expired_pendings.should == 0
|
||||
DomainCron.clean_expired_pendings.should == 0
|
||||
end
|
||||
|
||||
it 'should not find any domains with wrong pendings' do
|
||||
|
@ -131,7 +133,7 @@ describe Domain do
|
|||
domain.registrant_verification_asked_at = 30.days.ago
|
||||
domain.save
|
||||
|
||||
Domain.clean_expired_pendings.should == 0
|
||||
DomainCron.clean_expired_pendings.should == 0
|
||||
end
|
||||
|
||||
it 'should clean domain pendings' do
|
||||
|
@ -204,7 +206,9 @@ describe Domain do
|
|||
end
|
||||
|
||||
it 'should start delete period' do
|
||||
DomainCron.start_delete_period
|
||||
DomainDeleteJob.jobs.clear
|
||||
|
||||
DomainCron.destroy_delete_candidates
|
||||
@domain.reload
|
||||
@domain.statuses.include?(DomainStatus::DELETE_CANDIDATE).should == false
|
||||
|
||||
|
@ -212,19 +216,21 @@ describe Domain do
|
|||
@domain.statuses << DomainStatus::SERVER_DELETE_PROHIBITED # this prohibits delete_candidate
|
||||
@domain.save
|
||||
|
||||
DomainCron.start_delete_period
|
||||
DomainCron.destroy_delete_candidates
|
||||
@domain.reload
|
||||
@domain.statuses.include?(DomainStatus::DELETE_CANDIDATE).should == false
|
||||
|
||||
@domain.statuses = []
|
||||
@domain.save
|
||||
DomainCron.start_delete_period
|
||||
DomainCron.destroy_delete_candidates
|
||||
@domain.reload
|
||||
|
||||
@domain.statuses.include?(DomainStatus::DELETE_CANDIDATE).should == true
|
||||
end
|
||||
|
||||
it 'should destroy delete candidates' do
|
||||
DomainDeleteJob.jobs.clear
|
||||
|
||||
d = Fabricate(:domain)
|
||||
d.force_delete_at = Time.zone.now
|
||||
d.save
|
||||
|
@ -233,10 +239,14 @@ describe Domain do
|
|||
@domain.save
|
||||
|
||||
Domain.count.should == 2
|
||||
DomainCron.destroy_delete_candidates
|
||||
DomainDeleteJob.jobs.count.should == 2
|
||||
DomainDeleteJob.jobs.first.run_at.should <= Time.now + 24.hours
|
||||
ids = Domain.pluck(:id).sort
|
||||
DomainDeleteJob.jobs.map{|e| e.args.first}.sort.should == ids
|
||||
|
||||
DomainCron.start_delete_period
|
||||
|
||||
Domain.destroy_delete_candidates
|
||||
ids.each{|id| DomainDeleteJob.run(id) rescue "actially deleted" }
|
||||
Domain.count.should == 0
|
||||
end
|
||||
|
||||
|
@ -714,9 +724,7 @@ describe Domain do
|
|||
it 'should not create zone origin domain' do
|
||||
d = Fabricate.build(:domain, name: 'ee')
|
||||
d.save.should == false
|
||||
d.errors.full_messages.should match_array([
|
||||
"Data management policy violation: Domain name is blocked [name]"
|
||||
])
|
||||
d.errors.full_messages.should include("Data management policy violation: Domain name is blocked [name]")
|
||||
|
||||
d = Fabricate.build(:domain, name: 'bla')
|
||||
d.save.should == false
|
||||
|
@ -851,13 +859,13 @@ describe Domain do
|
|||
|
||||
it 'normalizes ns attrs' do
|
||||
d = Fabricate(:domain)
|
||||
d.nameservers.build(hostname: 'BLA.EXAMPLE.EE', ipv4: ' 192.168.1.1', ipv6: '1080:0:0:0:8:800:200c:417a')
|
||||
d.nameservers.build(hostname: 'BLA.EXAMPLE.EE', ipv4: [' 192.168.1.1'], ipv6: ['1080:0:0:0:8:800:200c:417a'])
|
||||
d.save
|
||||
|
||||
ns = d.nameservers.last
|
||||
expect(ns.hostname).to eq('bla.example.ee')
|
||||
expect(ns.ipv4).to eq('192.168.1.1')
|
||||
expect(ns.ipv6).to eq('1080:0:0:0:8:800:200C:417A')
|
||||
expect(ns.ipv4).to eq(['192.168.1.1'])
|
||||
expect(ns.ipv6).to eq(['1080:0:0:0:8:800:200C:417A'])
|
||||
end
|
||||
|
||||
it 'does not create a reserved domain' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue