]> source.dussan.org Git - redmine.git/commitdiff
Moved tests about session reset to functional tests.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 26 Feb 2012 12:00:41 +0000 (12:00 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 26 Feb 2012 12:00:41 +0000 (12:00 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9014 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/account_controller_test.rb
test/integration/account_test.rb

index 5bf65b9abb652ce8f65281a73ff0aaba17052da8..d501a34970293b033677d8807314d36bcfb3e54b 100644 (file)
@@ -61,6 +61,13 @@ class AccountControllerTest < ActionController::TestCase
     assert_error_tag :content => /Something wrong/
   end
 
+  def test_login_should_reset_session
+    @controller.expects(:reset_session).once
+
+    post :login, :username => 'jsmith', :password => 'jsmith'
+    assert_response 302
+  end
+
   if Object.const_defined?(:OpenID)
 
   def test_login_with_openid_for_existing_user
@@ -171,6 +178,14 @@ class AccountControllerTest < ActionController::TestCase
     assert_nil @request.session[:user_id]
   end
 
+  def test_logout_should_reset_session
+    @controller.expects(:reset_session).once
+
+    @request.session[:user_id] = 2
+    get :logout
+    assert_response 302
+  end
+
   def test_get_register_with_registration_on
     with_settings :self_registration => '3' do
       get :register
index 11afd2b079f5401ad9e64bffa960c93a26d2cd20..1e7e3b3298130cfa70acbde30f8f52d032ab87bd 100644 (file)
@@ -179,22 +179,4 @@ class AccountTest < ActionController::IntegrationTest
     assert_equal 66, user.auth_source_id
     assert user.hashed_password.blank?
   end
-
-  def test_login_and_logout_should_clear_session
-    get '/login'
-    sid = session[:session_id]
-
-    post '/login', :username => 'admin', :password => 'admin'
-    assert_redirected_to '/my/page'
-    assert_not_equal sid, session[:session_id], "login should reset session"
-    assert_equal 1, session[:user_id]
-    sid = session[:session_id]
-
-    get '/'
-    assert_equal sid, session[:session_id]
-
-    get '/logout'
-    assert_not_equal sid, session[:session_id], "logout should reset session"
-    assert_nil session[:user_id]
-  end
 end