mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 22:46:22 +02:00
Move throttling feature from gem back to the app
This commit is contained in:
parent
83413213d9
commit
f17ef17d16
9 changed files with 230 additions and 2 deletions
|
@ -193,7 +193,7 @@ class EppDomainInfoBaseTest < EppTestCase
|
|||
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
|
||||
<command>
|
||||
<info>
|
||||
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee')}">
|
||||
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee', for_version: '1.2')}">
|
||||
<domain:name>#{domain.name}</domain:name>
|
||||
</domain:info>
|
||||
</info>
|
||||
|
|
33
test/lib/shunter/base_test.rb
Normal file
33
test/lib/shunter/base_test.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "test_helper"
|
||||
require "action_controller"
|
||||
require "pry"
|
||||
|
||||
class BaseTest < Minitest::Test
|
||||
ENV["shunter_enabled"] = 'true'
|
||||
|
||||
def test_throttling_works_on_inclusion
|
||||
ENV["shunter_default_adapter"] = "Shunter::Adapters::Memory"
|
||||
ENV["shunter_default_threshold"] = "100"
|
||||
adapter = ENV["shunter_default_adapter"].constantize.new
|
||||
adapter.clear!
|
||||
|
||||
TestKlass.new.throttle do
|
||||
TestKlass.new.test
|
||||
end
|
||||
end
|
||||
|
||||
class TestKlass < ::ActionController::Base
|
||||
THROTTLED_ACTIONS = %i[test].freeze
|
||||
include Shunter::Integration::Throttle
|
||||
|
||||
def test
|
||||
"test"
|
||||
end
|
||||
|
||||
def throttled_user
|
||||
@throttled_user ||= OpenStruct.new(id: 1)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -18,7 +18,6 @@ require 'capybara/minitest'
|
|||
require 'webmock/minitest'
|
||||
require 'support/assertions/epp_assertions'
|
||||
require 'sidekiq/testing'
|
||||
require 'spy/integration'
|
||||
|
||||
Sidekiq::Testing.fake!
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue