summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/functional/sessions_controller_test.rb44
1 files changed, 27 insertions, 17 deletions
diff --git a/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb
index 69e782318..6a5a55ce3 100644
--- a/test/functional/sessions_controller_test.rb
+++ b/test/functional/sessions_controller_test.rb
@@ -37,10 +37,7 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => 10.hours.ago, :updated_on => 10.hours.ago)
created = token.reload.created_on
- get :index, :session => {
- :user_id => 2,
- :tk => token.value
- }
+ get(:index, :session => {:user_id => 2, :tk => token.value})
assert_response :success
token.reload
assert_equal created.to_i, token.created_on.to_i
@@ -53,18 +50,13 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_lifetime => '0', :session_timeout => '0' do
- get :index, :session => {
- :user_id => 2,
- :tk => token.value
- }
+ get(:index, :session => {:user_id => 2, :tk => token.value})
assert_response :success
end
end
def test_user_session_without_token_should_be_reset
- get :index, :session => {
- :user_id => 2
- }
+ get(:index, :session => {:user_id => 2})
assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
end
@@ -73,10 +65,13 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_timeout => '720' do
- get :index, :session => {
+ get(
+ :index,
+ :session => {
:user_id => 2,
:tk => token.value
}
+ )
assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
end
end
@@ -86,10 +81,13 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_timeout => '720' do
- get :index, :session => {
+ get(
+ :index,
+ :session => {
:user_id => 2,
:tk => token.value
}
+ )
assert_response :success
end
end
@@ -99,10 +97,13 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_timeout => '60' do
- get :index, :session => {
+ get(
+ :index,
+ :session => {
:user_id => 2,
:tk => token.value
}
+ )
assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
end
end
@@ -112,10 +113,13 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_timeout => '60' do
- get :index, :session => {
+ get(
+ :index,
+ :session => {
:user_id => 2,
:tk => token.value
}
+ )
assert_response :success
end
end
@@ -128,10 +132,13 @@ class SessionsControllerTest < Redmine::ControllerTest
autologin_token = Token.create!(:user_id => 2, :action => 'autologin', :created_on => 1.day.ago)
@request.cookies['autologin'] = autologin_token.value
- get :index, :session => {
+ get(
+ :index,
+ :session => {
:user_id => 2,
:tk => token.value
}
+ )
assert_equal 2, session[:user_id]
assert_response :success
assert_not_equal token.value, session[:tk]
@@ -147,10 +154,13 @@ class SessionsControllerTest < Redmine::ControllerTest
token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created)
with_settings :session_timeout => '60' do
- get :index, :session => {
+ get(
+ :index,
+ :session => {
:user_id => user.id,
:tk => token.value
}
+ )
assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F'
assert_include "Veuillez vous reconnecter", flash[:error]
assert_equal :fr, current_language