mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 19:48:28 +02:00
Add sidekiq as a job backend
This commit is contained in:
parent
313731232e
commit
929ada8fd0
22 changed files with 109 additions and 154 deletions
|
@ -10,13 +10,7 @@ class StartTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_sets_expired
|
||||
job_count = lambda do
|
||||
QueJob.where("args->>0 = '#{@domain.id}'", job_class: DomainExpireEmailJob.name).count
|
||||
end
|
||||
|
||||
one_job_per_contact_email = @domain.expired_domain_contact_emails.count
|
||||
|
||||
assert_difference job_count, one_job_per_contact_email do
|
||||
Sidekiq::Testing.fake! do
|
||||
perform_enqueued_jobs do
|
||||
DomainCron.start_expire_period
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
require 'test_helper'
|
||||
require 'sidekiq/testing'
|
||||
Sidekiq::Testing.fake!
|
||||
|
||||
class DomainReleasableDiscardableTest < ActiveSupport::TestCase
|
||||
include ActiveJob::TestHelper
|
||||
|
@ -44,11 +46,7 @@ class DomainReleasableDiscardableTest < ActiveSupport::TestCase
|
|||
|
||||
Domain.release_domains
|
||||
|
||||
job_count = lambda do
|
||||
QueJob.where("args->>0 = '#{@domain.id}'", job_class: DomainDeleteJob.name).count
|
||||
end
|
||||
|
||||
assert_no_difference job_count, 'A domain should not be discarded again' do
|
||||
assert_no_enqueued_jobs do
|
||||
Domain.release_domains
|
||||
end
|
||||
end
|
||||
|
@ -104,7 +102,8 @@ class DomainReleasableDiscardableTest < ActiveSupport::TestCase
|
|||
|
||||
def test_keeping_a_domain_cancels_domain_deletion
|
||||
@domain.update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
@domain.keep
|
||||
assert_nil QueJob.find_by("args->>0 = '#{@domain.id}'", job_class: DomainDeleteJob.name)
|
||||
assert_no_enqueued_jobs only: DomainDeleteJob do
|
||||
@domain.keep
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
require 'application_system_test_case'
|
||||
require 'sidekiq/testing'
|
||||
|
||||
Sidekiq::Testing.fake!
|
||||
|
||||
class AdminDomainsTestTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class DomainDeleteConfirmsTest < ApplicationSystemTestCase
|
||||
include ActionMailer::TestHelper
|
||||
setup do
|
||||
@user = users(:registrant)
|
||||
sign_in @user
|
||||
|
||||
@domain = domains(:shop)
|
||||
@domain.registrant_verification_asked!('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<epp></epp>', @user.id)
|
||||
@domain.pending_delete!
|
||||
end
|
||||
|
||||
def test_enqueues_approve_job_after_verification
|
||||
visit registrant_domain_delete_confirm_url(@domain.id, token: @domain.registrant_verification_token)
|
||||
|
||||
click_on 'Confirm domain delete'
|
||||
|
||||
assert_text 'Domain registrant change has successfully received.'
|
||||
|
||||
assert_enqueued_jobs 1, only: DomainDeleteConfirmJob
|
||||
end
|
||||
|
||||
def test_enqueues_reject_job_after_verification
|
||||
visit registrant_domain_delete_confirm_url(@domain.id, token: @domain.registrant_verification_token)
|
||||
|
||||
click_on 'Reject domain delete'
|
||||
|
||||
assert_text 'Domain registrant change has been rejected successfully.'
|
||||
|
||||
assert_enqueued_jobs 1, only: DomainDeleteConfirmJob
|
||||
end
|
||||
|
||||
def test_saves_whodunnit_info_after_verifivation
|
||||
visit registrant_domain_delete_confirm_url(@domain.id, token: @domain.registrant_verification_token)
|
||||
token = @domain.registrant_verification_token
|
||||
click_on 'Confirm domain delete'
|
||||
assert_text 'Domain registrant change has successfully received.'
|
||||
|
||||
refute RegistrantVerification.find_by(verification_token:token).updator_str.empty?
|
||||
end
|
||||
end
|
|
@ -18,6 +18,9 @@ require 'capybara/rails'
|
|||
require 'capybara/minitest'
|
||||
require 'webmock/minitest'
|
||||
require 'support/assertions/epp_assertions'
|
||||
require 'sidekiq/testing'
|
||||
|
||||
Sidekiq::Testing.fake!
|
||||
|
||||
|
||||
# `bin/rails test` is not the same as `bin/rake test`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue