##// END OF EJS Templates
scm: cvs: change project id of functional test from 1 to 3....
Toshi MARUYAMA -
r4669:2b79e05e6c52
parent child
Show More
@@ -29,7 +29,8 class RepositoriesCvsControllerTest < ActionController::TestCase
29 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
29 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
30 # CVS module
30 # CVS module
31 MODULE_NAME = 'test'
31 MODULE_NAME = 'test'
32
32 PRJ_ID = 3
33
33 def setup
34 def setup
34 @controller = RepositoriesController.new
35 @controller = RepositoriesController.new
35 @request = ActionController::TestRequest.new
36 @request = ActionController::TestRequest.new
@@ -37,14 +38,18 class RepositoriesCvsControllerTest < ActionController::TestCase
37 Setting.default_language = 'en'
38 Setting.default_language = 'en'
38 User.current = nil
39 User.current = nil
39
40
40 @project = Project.find(1)
41 @project = Project.find(PRJ_ID)
41 @project.repository = Repository::Cvs.create(:root_url => REPOSITORY_PATH,
42 @repository = Repository::Cvs.create(:project => Project.find(PRJ_ID),
42 :url => MODULE_NAME)
43 :root_url => REPOSITORY_PATH,
44 :url => MODULE_NAME)
45 assert @repository
43 end
46 end
44
47
45 if File.directory?(REPOSITORY_PATH)
48 if File.directory?(REPOSITORY_PATH)
46 def test_show
49 def test_show
47 get :show, :id => 1
50 @repository.fetch_changesets
51 @repository.reload
52 get :show, :id => PRJ_ID
48 assert_response :success
53 assert_response :success
49 assert_template 'show'
54 assert_template 'show'
50 assert_not_nil assigns(:entries)
55 assert_not_nil assigns(:entries)
@@ -52,7 +57,9 class RepositoriesCvsControllerTest < ActionController::TestCase
52 end
57 end
53
58
54 def test_browse_root
59 def test_browse_root
55 get :show, :id => 1
60 @repository.fetch_changesets
61 @repository.reload
62 get :show, :id => PRJ_ID
56 assert_response :success
63 assert_response :success
57 assert_template 'show'
64 assert_template 'show'
58 assert_not_nil assigns(:entries)
65 assert_not_nil assigns(:entries)
@@ -66,7 +73,9 class RepositoriesCvsControllerTest < ActionController::TestCase
66 end
73 end
67
74
68 def test_browse_directory
75 def test_browse_directory
69 get :show, :id => 1, :path => ['images']
76 @repository.fetch_changesets
77 @repository.reload
78 get :show, :id => PRJ_ID, :path => ['images']
70 assert_response :success
79 assert_response :success
71 assert_template 'show'
80 assert_template 'show'
72 assert_not_nil assigns(:entries)
81 assert_not_nil assigns(:entries)
@@ -78,8 +87,9 class RepositoriesCvsControllerTest < ActionController::TestCase
78 end
87 end
79
88
80 def test_browse_at_given_revision
89 def test_browse_at_given_revision
81 Project.find(1).repository.fetch_changesets
90 @repository.fetch_changesets
82 get :show, :id => 1, :path => ['images'], :rev => 1
91 @repository.reload
92 get :show, :id => PRJ_ID, :path => ['images'], :rev => 1
83 assert_response :success
93 assert_response :success
84 assert_template 'show'
94 assert_template 'show'
85 assert_not_nil assigns(:entries)
95 assert_not_nil assigns(:entries)
@@ -87,7 +97,9 class RepositoriesCvsControllerTest < ActionController::TestCase
87 end
97 end
88
98
89 def test_entry
99 def test_entry
90 get :entry, :id => 1, :path => ['sources', 'watchers_controller.rb']
100 @repository.fetch_changesets
101 @repository.reload
102 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
91 assert_response :success
103 assert_response :success
92 assert_template 'entry'
104 assert_template 'entry'
93 assert_no_tag :tag => 'td', :attributes => { :class => /line-code/},
105 assert_no_tag :tag => 'td', :attributes => { :class => /line-code/},
@@ -96,8 +108,9 class RepositoriesCvsControllerTest < ActionController::TestCase
96
108
97 def test_entry_at_given_revision
109 def test_entry_at_given_revision
98 # changesets must be loaded
110 # changesets must be loaded
99 Project.find(1).repository.fetch_changesets
111 @repository.fetch_changesets
100 get :entry, :id => 1, :path => ['sources', 'watchers_controller.rb'], :rev => 2
112 @repository.reload
113 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], :rev => 2
101 assert_response :success
114 assert_response :success
102 assert_template 'entry'
115 assert_template 'entry'
103 # this line was removed in r3
116 # this line was removed in r3
@@ -106,18 +119,24 class RepositoriesCvsControllerTest < ActionController::TestCase
106 end
119 end
107
120
108 def test_entry_not_found
121 def test_entry_not_found
109 get :entry, :id => 1, :path => ['sources', 'zzz.c']
122 @repository.fetch_changesets
123 @repository.reload
124 get :entry, :id => PRJ_ID, :path => ['sources', 'zzz.c']
110 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
125 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
111 :content => /The entry or revision was not found in the repository/
126 :content => /The entry or revision was not found in the repository/
112 end
127 end
113
128
114 def test_entry_download
129 def test_entry_download
115 get :entry, :id => 1, :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
130 @repository.fetch_changesets
131 @repository.reload
132 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
116 assert_response :success
133 assert_response :success
117 end
134 end
118
135
119 def test_directory_entry
136 def test_directory_entry
120 get :entry, :id => 1, :path => ['sources']
137 @repository.fetch_changesets
138 @repository.reload
139 get :entry, :id => PRJ_ID, :path => ['sources']
121 assert_response :success
140 assert_response :success
122 assert_template 'show'
141 assert_template 'show'
123 assert_not_nil assigns(:entry)
142 assert_not_nil assigns(:entry)
@@ -125,8 +144,9 class RepositoriesCvsControllerTest < ActionController::TestCase
125 end
144 end
126
145
127 def test_diff
146 def test_diff
128 Project.find(1).repository.fetch_changesets
147 @repository.fetch_changesets
129 get :diff, :id => 1, :rev => 3, :type => 'inline'
148 @repository.reload
149 get :diff, :id => PRJ_ID, :rev => 3, :type => 'inline'
130 assert_response :success
150 assert_response :success
131 assert_template 'diff'
151 assert_template 'diff'
132 assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_out' },
152 assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_out' },
@@ -136,8 +156,9 class RepositoriesCvsControllerTest < ActionController::TestCase
136 end
156 end
137
157
138 def test_annotate
158 def test_annotate
139 Project.find(1).repository.fetch_changesets
159 @repository.fetch_changesets
140 get :annotate, :id => 1, :path => ['sources', 'watchers_controller.rb']
160 @repository.reload
161 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
141 assert_response :success
162 assert_response :success
142 assert_template 'annotate'
163 assert_template 'annotate'
143 # 1.1 line
164 # 1.1 line
General Comments 0
You need to be logged in to leave comments. Login now