mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 23:54:44 +02:00
Do not take time into account when checking EPP session limit
This commit is contained in:
parent
1e997ad5b1
commit
9eb7d3527b
2 changed files with 2 additions and 5 deletions
|
@ -12,7 +12,7 @@ class EppSession < ApplicationRecord
|
||||||
alias_attribute :last_access, :updated_at
|
alias_attribute :last_access, :updated_at
|
||||||
|
|
||||||
def self.limit_reached?(registrar)
|
def self.limit_reached?(registrar)
|
||||||
count = where(user_id: registrar.api_users.ids).where('updated_at >= ?', Time.zone.now - 1.second).count
|
count = where(user_id: registrar.api_users.ids).count
|
||||||
count >= limit_per_registrar
|
count >= limit_per_registrar
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -144,12 +144,9 @@ class EppLoginTest < EppTestCase
|
||||||
|
|
||||||
def test_user_cannot_login_when_session_limit_is_exceeded
|
def test_user_cannot_login_when_session_limit_is_exceeded
|
||||||
user = users(:api_bestnames)
|
user = users(:api_bestnames)
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
|
||||||
eliminate_effect_of_existing_epp_sessions
|
eliminate_effect_of_existing_epp_sessions
|
||||||
EppSession.limit_per_registrar = 1
|
EppSession.limit_per_registrar = 1
|
||||||
EppSession.create!(session_id: 'any',
|
EppSession.create!(session_id: 'any', user: user)
|
||||||
user: user,
|
|
||||||
updated_at: Time.zone.parse('2010-07-05'))
|
|
||||||
|
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue