Remove hardcoded value

This commit is contained in:
Artur Beljajev 2019-09-17 17:17:51 +03:00 committed by Alex Sherman
parent daeb00ebe7
commit 59fbcde4ca
3 changed files with 5 additions and 8 deletions

View file

@ -6,11 +6,10 @@ class EppSession < ApplicationRecord
class_attribute :timeout
self.timeout = (ENV['epp_session_timeout_seconds'] || 300).to_i.seconds
alias_attribute :last_access, :updated_at
class_attribute :limit_per_registrar
self.limit_per_registrar = (ENV['epp_session_limit_per_registrar'] || 4).to_i
def self.limit_per_registrar
4
end
alias_attribute :last_access, :updated_at
def self.limit_reached?(registrar)
count = where(user_id: registrar.api_users.ids).where('updated_at >= ?', Time.zone.now - 1.second).count

View file

@ -170,6 +170,8 @@ tara_rant_redirect_uri: 'redirect_uri'
default_email_validation_type: 'regex'
epp_session_limit_per_registrar: '4'
# Since the keys for staging are absent from the repo, we need to supply them separate for testing.
test:
payments_seb_bank_certificate: 'test/fixtures/files/seb_bank_cert.pem'

View file

@ -49,10 +49,6 @@ class EppSessionTest < ActiveSupport::TestCase
end
end
def test_limit_per_registrar
assert_equal 4, EppSession.limit_per_registrar
end
def test_limit_is_per_registrar
travel_to Time.zone.parse('2010-07-05')
EppSession.delete_all