GITSCM: Tweaked git scm view layout
[gitredmine.git] / test / integration / admin_test.rb
bloba424247ccc893e15a0441857d3b7b48787ae121c
1 # redMine - project management software
2 # Copyright (C) 2006  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.
8
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.
13
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 AdminTest < ActionController::IntegrationTest
21   fixtures :users
23   def test_add_user
24     log_user("admin", "admin")
25     get "/users/add"
26     assert_response :success
27     assert_template "users/add"
28     post "/users/add", :user => { :login => "psmith", :firstname => "Paul", :lastname => "Smith", :mail => "psmith@somenet.foo", :language => "en" }, :password => "psmith09", :password_confirmation => "psmith09"
29     assert_redirected_to "users/list"
30     
31     user = User.find_by_login("psmith")
32     assert_kind_of User, user
33     logged_user = User.try_to_login("psmith", "psmith09")
34     assert_kind_of User, logged_user
35     assert_equal "Paul", logged_user.firstname
36     
37     post "users/edit", :id => user.id, :user => { :status => User::STATUS_LOCKED }
38     assert_redirected_to "users/list"
39     locked_user = User.try_to_login("psmith", "psmith09")
40     assert_equal nil, locked_user
41   end
42   
43   def test_add_project
44     log_user("admin", "admin")
45     get "projects/add"
46     assert_response :success
47     assert_template "projects/add"
48     post "projects/add", :project => { :name => "blog", 
49                                        :description => "weblog",
50                                        :identifier => "blog",
51                                        :is_public => 1 },
52                          'custom_fields[3]' => 'Beta'
53     assert_redirected_to "admin/projects"
54     assert_equal 'Successful creation.', flash[:notice]
55     
56     project = Project.find_by_name("blog")
57     assert_kind_of Project, project
58     assert_equal "weblog", project.description 
59     assert_equal true, project.is_public?
60     
61     get "admin/projects"
62     assert_response :success
63     assert_template "admin/projects"
64   end  
65 end