1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 require "#{File.dirname(__FILE__)}/../test_helper"
20 class AccountTest < ActionController::IntegrationTest
23 # Replace this with your real tests.
26 assert_redirected_to "account/login"
27 log_user('jsmith', 'jsmith')
30 assert_response :success
31 assert_template "my/account"
34 def test_lost_password
37 get "account/lost_password"
38 assert_response :success
39 assert_template "account/lost_password"
41 post "account/lost_password", :mail => 'jsmith@somenet.foo'
42 assert_redirected_to "account/login"
44 token = Token.find(:first)
45 assert_equal 'recovery', token.action
46 assert_equal 'jsmith@somenet.foo', token.user.mail
47 assert !token.expired?
49 get "account/lost_password", :token => token.value
50 assert_response :success
51 assert_template "account/password_recovery"
53 post "account/lost_password", :token => token.value, :new_password => 'newpass', :new_password_confirmation => 'newpass'
54 assert_redirected_to "account/login"
55 assert_equal 'Password was successfully updated.', flash[:notice]
57 log_user('jsmith', 'newpass')
58 assert_equal 0, Token.count