Mercurial > hg > soundsoftware-site
comparison test/functional/sys_controller_test.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2011 Jean-Philippe Lang | 2 # Copyright (C) 2006-2012 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
29 @controller = SysController.new | 29 @controller = SysController.new |
30 @request = ActionController::TestRequest.new | 30 @request = ActionController::TestRequest.new |
31 @response = ActionController::TestResponse.new | 31 @response = ActionController::TestResponse.new |
32 Setting.sys_api_enabled = '1' | 32 Setting.sys_api_enabled = '1' |
33 Setting.enabled_scm = %w(Subversion Git) | 33 Setting.enabled_scm = %w(Subversion Git) |
34 end | |
35 | |
36 def teardown | |
37 Setting.clear_cache | |
34 end | 38 end |
35 | 39 |
36 def test_projects_with_repository_enabled | 40 def test_projects_with_repository_enabled |
37 get :projects | 41 get :projects |
38 assert_response :success | 42 assert_response :success |
65 } | 69 } |
66 assert_no_tag 'extra-info' | 70 assert_no_tag 'extra-info' |
67 assert_no_tag 'extra_info' | 71 assert_no_tag 'extra_info' |
68 end | 72 end |
69 | 73 |
74 def test_create_already_existing | |
75 post :create_project_repository, :id => 1, | |
76 :vendor => 'Subversion', | |
77 :repository => { :url => 'file:///create/project/repository/subproject2'} | |
78 | |
79 assert_response :conflict | |
80 end | |
81 | |
82 def test_create_with_failure | |
83 post :create_project_repository, :id => 4, | |
84 :vendor => 'Subversion', | |
85 :repository => { :url => 'invalid url'} | |
86 | |
87 assert_response :unprocessable_entity | |
88 end | |
89 | |
70 def test_fetch_changesets | 90 def test_fetch_changesets |
71 Repository::Subversion.any_instance.expects(:fetch_changesets).returns(true) | 91 Repository::Subversion.any_instance.expects(:fetch_changesets).twice.returns(true) |
72 get :fetch_changesets | 92 get :fetch_changesets |
73 assert_response :success | 93 assert_response :success |
74 end | 94 end |
75 | 95 |
76 def test_fetch_changesets_one_project | 96 def test_fetch_changesets_one_project_by_identifier |
77 Repository::Subversion.any_instance.expects(:fetch_changesets).returns(true) | 97 Repository::Subversion.any_instance.expects(:fetch_changesets).once.returns(true) |
78 get :fetch_changesets, :id => 'ecookbook' | 98 get :fetch_changesets, :id => 'ecookbook' |
99 assert_response :success | |
100 end | |
101 | |
102 def test_fetch_changesets_one_project_by_id | |
103 Repository::Subversion.any_instance.expects(:fetch_changesets).once.returns(true) | |
104 get :fetch_changesets, :id => '1' | |
79 assert_response :success | 105 assert_response :success |
80 end | 106 end |
81 | 107 |
82 def test_fetch_changesets_unknown_project | 108 def test_fetch_changesets_unknown_project |
83 get :fetch_changesets, :id => 'unknown' | 109 get :fetch_changesets, :id => 'unknown' |