Keep track of valid user sessions (#21058).

git-svn-id: http://svn.redmine.org/redmine/trunk@14735 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2015-10-24 10:15:22 +00:00
parent a371c8d850
commit 4cd22dcc55
12 changed files with 340 additions and 208 deletions

View File

@@ -36,6 +36,19 @@ class TokenTest < ActiveSupport::TestCase
assert Token.exists?(t2.id)
end
def test_create_session_token_should_keep_last_10_tokens
Token.delete_all
user = User.find(1)
assert_difference 'Token.count', 10 do
10.times { Token.create!(:user => user, :action => 'session') }
end
assert_no_difference 'Token.count' do
Token.create!(:user => user, :action => 'session')
end
end
def test_destroy_expired_should_not_destroy_feeds_and_api_tokens
Token.delete_all