Chris@0
|
1 # redMine - project management software
|
Chris@0
|
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
|
Chris@0
|
3 #
|
Chris@0
|
4 # This program is free software; you can redistribute it and/or
|
Chris@0
|
5 # modify it under the terms of the GNU General Public License
|
Chris@0
|
6 # as published by the Free Software Foundation; either version 2
|
Chris@0
|
7 # of the License, or (at your option) any later version.
|
Chris@0
|
8 #
|
Chris@0
|
9 # This program is distributed in the hope that it will be useful,
|
Chris@0
|
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Chris@0
|
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
Chris@0
|
12 # GNU General Public License for more details.
|
Chris@0
|
13 #
|
Chris@0
|
14 # You should have received a copy of the GNU General Public License
|
Chris@0
|
15 # along with this program; if not, write to the Free Software
|
Chris@0
|
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Chris@0
|
17
|
Chris@0
|
18 require File.dirname(__FILE__) + '/../test_helper'
|
Chris@0
|
19 require 'wiki_controller'
|
Chris@0
|
20
|
Chris@0
|
21 # Re-raise errors caught by the controller.
|
Chris@0
|
22 class WikiController; def rescue_action(e) raise e end; end
|
Chris@0
|
23
|
Chris@0
|
24 class WikiControllerTest < ActionController::TestCase
|
Chris@0
|
25 fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments
|
Chris@0
|
26
|
Chris@0
|
27 def setup
|
Chris@0
|
28 @controller = WikiController.new
|
Chris@0
|
29 @request = ActionController::TestRequest.new
|
Chris@0
|
30 @response = ActionController::TestResponse.new
|
Chris@0
|
31 User.current = nil
|
Chris@0
|
32 end
|
Chris@0
|
33
|
Chris@0
|
34 def test_show_start_page
|
chris@37
|
35 get :show, :project_id => 'ecookbook'
|
Chris@0
|
36 assert_response :success
|
Chris@0
|
37 assert_template 'show'
|
Chris@0
|
38 assert_tag :tag => 'h1', :content => /CookBook documentation/
|
Chris@0
|
39
|
Chris@0
|
40 # child_pages macro
|
Chris@0
|
41 assert_tag :ul, :attributes => { :class => 'pages-hierarchy' },
|
Chris@0
|
42 :child => { :tag => 'li',
|
Chris@0
|
43 :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' },
|
Chris@0
|
44 :content => 'Page with an inline image' } }
|
Chris@0
|
45 end
|
Chris@0
|
46
|
Chris@0
|
47 def test_show_page_with_name
|
chris@37
|
48 get :show, :project_id => 1, :id => 'Another_page'
|
Chris@0
|
49 assert_response :success
|
Chris@0
|
50 assert_template 'show'
|
Chris@0
|
51 assert_tag :tag => 'h1', :content => /Another page/
|
Chris@0
|
52 # Included page with an inline image
|
Chris@0
|
53 assert_tag :tag => 'p', :content => /This is an inline image/
|
Chris@0
|
54 assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3',
|
Chris@0
|
55 :alt => 'This is a logo' }
|
Chris@0
|
56 end
|
Chris@0
|
57
|
Chris@0
|
58 def test_show_with_sidebar
|
Chris@0
|
59 page = Project.find(1).wiki.pages.new(:title => 'Sidebar')
|
Chris@0
|
60 page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
|
Chris@0
|
61 page.save!
|
Chris@0
|
62
|
chris@37
|
63 get :show, :project_id => 1, :id => 'Another_page'
|
Chris@0
|
64 assert_response :success
|
Chris@0
|
65 assert_tag :tag => 'div', :attributes => {:id => 'sidebar'},
|
Chris@0
|
66 :content => /Side bar content for test_show_with_sidebar/
|
Chris@0
|
67 end
|
Chris@0
|
68
|
Chris@0
|
69 def test_show_unexistent_page_without_edit_right
|
chris@37
|
70 get :show, :project_id => 1, :id => 'Unexistent page'
|
Chris@0
|
71 assert_response 404
|
Chris@0
|
72 end
|
Chris@0
|
73
|
Chris@0
|
74 def test_show_unexistent_page_with_edit_right
|
Chris@0
|
75 @request.session[:user_id] = 2
|
chris@37
|
76 get :show, :project_id => 1, :id => 'Unexistent page'
|
Chris@0
|
77 assert_response :success
|
Chris@0
|
78 assert_template 'edit'
|
Chris@0
|
79 end
|
Chris@0
|
80
|
Chris@0
|
81 def test_create_page
|
Chris@0
|
82 @request.session[:user_id] = 2
|
chris@37
|
83 put :update, :project_id => 1,
|
chris@37
|
84 :id => 'New page',
|
Chris@0
|
85 :content => {:comments => 'Created the page',
|
Chris@0
|
86 :text => "h1. New page\n\nThis is a new page",
|
Chris@0
|
87 :version => 0}
|
chris@37
|
88 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'New_page'
|
Chris@0
|
89 page = Project.find(1).wiki.find_page('New page')
|
Chris@0
|
90 assert !page.new_record?
|
Chris@0
|
91 assert_not_nil page.content
|
Chris@0
|
92 assert_equal 'Created the page', page.content.comments
|
Chris@0
|
93 end
|
Chris@0
|
94
|
Chris@0
|
95 def test_create_page_with_attachments
|
Chris@0
|
96 @request.session[:user_id] = 2
|
Chris@0
|
97 assert_difference 'WikiPage.count' do
|
Chris@0
|
98 assert_difference 'Attachment.count' do
|
chris@37
|
99 put :update, :project_id => 1,
|
chris@37
|
100 :id => 'New page',
|
Chris@0
|
101 :content => {:comments => 'Created the page',
|
Chris@0
|
102 :text => "h1. New page\n\nThis is a new page",
|
Chris@0
|
103 :version => 0},
|
Chris@0
|
104 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
|
Chris@0
|
105 end
|
Chris@0
|
106 end
|
Chris@0
|
107 page = Project.find(1).wiki.find_page('New page')
|
Chris@0
|
108 assert_equal 1, page.attachments.count
|
Chris@0
|
109 assert_equal 'testfile.txt', page.attachments.first.filename
|
Chris@0
|
110 end
|
Chris@0
|
111
|
Chris@0
|
112 def test_preview
|
Chris@0
|
113 @request.session[:user_id] = 2
|
chris@37
|
114 xhr :post, :preview, :project_id => 1, :id => 'CookBook_documentation',
|
Chris@0
|
115 :content => { :comments => '',
|
Chris@0
|
116 :text => 'this is a *previewed text*',
|
Chris@0
|
117 :version => 3 }
|
Chris@0
|
118 assert_response :success
|
Chris@0
|
119 assert_template 'common/_preview'
|
Chris@0
|
120 assert_tag :tag => 'strong', :content => /previewed text/
|
Chris@0
|
121 end
|
Chris@0
|
122
|
Chris@0
|
123 def test_preview_new_page
|
Chris@0
|
124 @request.session[:user_id] = 2
|
chris@37
|
125 xhr :post, :preview, :project_id => 1, :id => 'New page',
|
Chris@0
|
126 :content => { :text => 'h1. New page',
|
Chris@0
|
127 :comments => '',
|
Chris@0
|
128 :version => 0 }
|
Chris@0
|
129 assert_response :success
|
Chris@0
|
130 assert_template 'common/_preview'
|
Chris@0
|
131 assert_tag :tag => 'h1', :content => /New page/
|
Chris@0
|
132 end
|
Chris@0
|
133
|
Chris@0
|
134 def test_history
|
chris@37
|
135 get :history, :project_id => 1, :id => 'CookBook_documentation'
|
Chris@0
|
136 assert_response :success
|
Chris@0
|
137 assert_template 'history'
|
Chris@0
|
138 assert_not_nil assigns(:versions)
|
Chris@0
|
139 assert_equal 3, assigns(:versions).size
|
Chris@0
|
140 assert_select "input[type=submit][name=commit]"
|
Chris@0
|
141 end
|
Chris@0
|
142
|
Chris@0
|
143 def test_history_with_one_version
|
chris@37
|
144 get :history, :project_id => 1, :id => 'Another_page'
|
Chris@0
|
145 assert_response :success
|
Chris@0
|
146 assert_template 'history'
|
Chris@0
|
147 assert_not_nil assigns(:versions)
|
Chris@0
|
148 assert_equal 1, assigns(:versions).size
|
Chris@0
|
149 assert_select "input[type=submit][name=commit]", false
|
Chris@0
|
150 end
|
Chris@0
|
151
|
Chris@0
|
152 def test_diff
|
chris@37
|
153 get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => 2, :version_from => 1
|
Chris@0
|
154 assert_response :success
|
Chris@0
|
155 assert_template 'diff'
|
Chris@0
|
156 assert_tag :tag => 'span', :attributes => { :class => 'diff_in'},
|
Chris@0
|
157 :content => /updated/
|
Chris@0
|
158 end
|
Chris@0
|
159
|
Chris@0
|
160 def test_annotate
|
chris@37
|
161 get :annotate, :project_id => 1, :id => 'CookBook_documentation', :version => 2
|
Chris@0
|
162 assert_response :success
|
Chris@0
|
163 assert_template 'annotate'
|
Chris@0
|
164 # Line 1
|
Chris@0
|
165 assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1' },
|
Chris@0
|
166 :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/ },
|
Chris@0
|
167 :child => { :tag => 'td', :content => /h1\. CookBook documentation/ }
|
Chris@0
|
168 # Line 2
|
Chris@0
|
169 assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '2' },
|
Chris@0
|
170 :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/ },
|
Chris@0
|
171 :child => { :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ }
|
Chris@0
|
172 end
|
chris@37
|
173
|
chris@37
|
174 def test_get_rename
|
chris@37
|
175 @request.session[:user_id] = 2
|
chris@37
|
176 get :rename, :project_id => 1, :id => 'Another_page'
|
chris@37
|
177 assert_response :success
|
chris@37
|
178 assert_template 'rename'
|
chris@37
|
179 assert_tag 'option',
|
chris@37
|
180 :attributes => {:value => ''},
|
chris@37
|
181 :content => '',
|
chris@37
|
182 :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}}
|
chris@37
|
183 assert_no_tag 'option',
|
chris@37
|
184 :attributes => {:selected => 'selected'},
|
chris@37
|
185 :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}}
|
chris@37
|
186 end
|
chris@37
|
187
|
chris@37
|
188 def test_get_rename_child_page
|
chris@37
|
189 @request.session[:user_id] = 2
|
chris@37
|
190 get :rename, :project_id => 1, :id => 'Child_1'
|
chris@37
|
191 assert_response :success
|
chris@37
|
192 assert_template 'rename'
|
chris@37
|
193 assert_tag 'option',
|
chris@37
|
194 :attributes => {:value => ''},
|
chris@37
|
195 :content => '',
|
chris@37
|
196 :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}}
|
chris@37
|
197 assert_tag 'option',
|
chris@37
|
198 :attributes => {:value => '2', :selected => 'selected'},
|
chris@37
|
199 :content => /Another page/,
|
chris@37
|
200 :parent => {
|
chris@37
|
201 :tag => 'select',
|
chris@37
|
202 :attributes => {:name => 'wiki_page[parent_id]'}
|
chris@37
|
203 }
|
chris@37
|
204 end
|
Chris@0
|
205
|
Chris@0
|
206 def test_rename_with_redirect
|
Chris@0
|
207 @request.session[:user_id] = 2
|
chris@37
|
208 post :rename, :project_id => 1, :id => 'Another_page',
|
Chris@0
|
209 :wiki_page => { :title => 'Another renamed page',
|
Chris@0
|
210 :redirect_existing_links => 1 }
|
chris@37
|
211 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page'
|
Chris@0
|
212 wiki = Project.find(1).wiki
|
Chris@0
|
213 # Check redirects
|
Chris@0
|
214 assert_not_nil wiki.find_page('Another page')
|
Chris@0
|
215 assert_nil wiki.find_page('Another page', :with_redirect => false)
|
Chris@0
|
216 end
|
Chris@0
|
217
|
Chris@0
|
218 def test_rename_without_redirect
|
Chris@0
|
219 @request.session[:user_id] = 2
|
chris@37
|
220 post :rename, :project_id => 1, :id => 'Another_page',
|
Chris@0
|
221 :wiki_page => { :title => 'Another renamed page',
|
Chris@0
|
222 :redirect_existing_links => "0" }
|
chris@37
|
223 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page'
|
Chris@0
|
224 wiki = Project.find(1).wiki
|
Chris@0
|
225 # Check that there's no redirects
|
Chris@0
|
226 assert_nil wiki.find_page('Another page')
|
Chris@0
|
227 end
|
Chris@0
|
228
|
chris@37
|
229 def test_rename_with_parent_assignment
|
chris@37
|
230 @request.session[:user_id] = 2
|
chris@37
|
231 post :rename, :project_id => 1, :id => 'Another_page',
|
chris@37
|
232 :wiki_page => { :title => 'Another page', :redirect_existing_links => "0", :parent_id => '4' }
|
chris@37
|
233 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page'
|
chris@37
|
234 assert_equal WikiPage.find(4), WikiPage.find_by_title('Another_page').parent
|
chris@37
|
235 end
|
chris@37
|
236
|
chris@37
|
237 def test_rename_with_parent_unassignment
|
chris@37
|
238 @request.session[:user_id] = 2
|
chris@37
|
239 post :rename, :project_id => 1, :id => 'Child_1',
|
chris@37
|
240 :wiki_page => { :title => 'Child 1', :redirect_existing_links => "0", :parent_id => '' }
|
chris@37
|
241 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Child_1'
|
chris@37
|
242 assert_nil WikiPage.find_by_title('Child_1').parent
|
chris@37
|
243 end
|
chris@37
|
244
|
Chris@0
|
245 def test_destroy_child
|
Chris@0
|
246 @request.session[:user_id] = 2
|
chris@37
|
247 delete :destroy, :project_id => 1, :id => 'Child_1'
|
chris@37
|
248 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
Chris@0
|
249 end
|
Chris@0
|
250
|
Chris@0
|
251 def test_destroy_parent
|
Chris@0
|
252 @request.session[:user_id] = 2
|
Chris@0
|
253 assert_no_difference('WikiPage.count') do
|
chris@37
|
254 delete :destroy, :project_id => 1, :id => 'Another_page'
|
Chris@0
|
255 end
|
Chris@0
|
256 assert_response :success
|
Chris@0
|
257 assert_template 'destroy'
|
Chris@0
|
258 end
|
Chris@0
|
259
|
Chris@0
|
260 def test_destroy_parent_with_nullify
|
Chris@0
|
261 @request.session[:user_id] = 2
|
Chris@0
|
262 assert_difference('WikiPage.count', -1) do
|
chris@37
|
263 delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'nullify'
|
Chris@0
|
264 end
|
chris@37
|
265 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
Chris@0
|
266 assert_nil WikiPage.find_by_id(2)
|
Chris@0
|
267 end
|
Chris@0
|
268
|
Chris@0
|
269 def test_destroy_parent_with_cascade
|
Chris@0
|
270 @request.session[:user_id] = 2
|
Chris@0
|
271 assert_difference('WikiPage.count', -3) do
|
chris@37
|
272 delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'destroy'
|
Chris@0
|
273 end
|
chris@37
|
274 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
Chris@0
|
275 assert_nil WikiPage.find_by_id(2)
|
Chris@0
|
276 assert_nil WikiPage.find_by_id(5)
|
Chris@0
|
277 end
|
Chris@0
|
278
|
Chris@0
|
279 def test_destroy_parent_with_reassign
|
Chris@0
|
280 @request.session[:user_id] = 2
|
Chris@0
|
281 assert_difference('WikiPage.count', -1) do
|
chris@37
|
282 delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'reassign', :reassign_to_id => 1
|
Chris@0
|
283 end
|
chris@37
|
284 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
|
Chris@0
|
285 assert_nil WikiPage.find_by_id(2)
|
Chris@0
|
286 assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent
|
Chris@0
|
287 end
|
Chris@0
|
288
|
chris@37
|
289 def test_index
|
chris@37
|
290 get :index, :project_id => 'ecookbook'
|
Chris@0
|
291 assert_response :success
|
chris@37
|
292 assert_template 'index'
|
Chris@0
|
293 pages = assigns(:pages)
|
Chris@0
|
294 assert_not_nil pages
|
Chris@0
|
295 assert_equal Project.find(1).wiki.pages.size, pages.size
|
Chris@0
|
296
|
Chris@0
|
297 assert_tag :ul, :attributes => { :class => 'pages-hierarchy' },
|
Chris@0
|
298 :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/CookBook_documentation' },
|
Chris@0
|
299 :content => 'CookBook documentation' },
|
Chris@0
|
300 :child => { :tag => 'ul',
|
Chris@0
|
301 :child => { :tag => 'li',
|
Chris@0
|
302 :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' },
|
Chris@0
|
303 :content => 'Page with an inline image' } } } },
|
Chris@0
|
304 :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' },
|
Chris@0
|
305 :content => 'Another page' } }
|
Chris@0
|
306 end
|
chris@37
|
307
|
chris@37
|
308 context "GET :export" do
|
chris@37
|
309 context "with an authorized user to export the wiki" do
|
chris@37
|
310 setup do
|
chris@37
|
311 @request.session[:user_id] = 2
|
chris@37
|
312 get :export, :project_id => 'ecookbook'
|
chris@37
|
313 end
|
chris@37
|
314
|
chris@37
|
315 should_respond_with :success
|
chris@37
|
316 should_assign_to :pages
|
chris@37
|
317 should_respond_with_content_type "text/html"
|
chris@37
|
318 should "export all of the wiki pages to a single html file" do
|
chris@37
|
319 assert_select "a[name=?]", "CookBook_documentation"
|
chris@37
|
320 assert_select "a[name=?]", "Another_page"
|
chris@37
|
321 assert_select "a[name=?]", "Page_with_an_inline_image"
|
chris@37
|
322 end
|
chris@37
|
323
|
chris@37
|
324 end
|
chris@37
|
325
|
chris@37
|
326 context "with an unauthorized user" do
|
chris@37
|
327 setup do
|
chris@37
|
328 get :export, :project_id => 'ecookbook'
|
chris@37
|
329
|
chris@37
|
330 should_respond_with :redirect
|
chris@37
|
331 should_redirect_to('wiki index') { {:action => 'show', :project_id => @project, :id => nil} }
|
chris@37
|
332 end
|
chris@37
|
333 end
|
chris@37
|
334 end
|
chris@37
|
335
|
chris@37
|
336 context "GET :date_index" do
|
chris@37
|
337 setup do
|
chris@37
|
338 get :date_index, :project_id => 'ecookbook'
|
chris@37
|
339 end
|
chris@37
|
340
|
chris@37
|
341 should_respond_with :success
|
chris@37
|
342 should_assign_to :pages
|
chris@37
|
343 should_assign_to :pages_by_date
|
chris@37
|
344 should_render_template 'wiki/date_index'
|
chris@37
|
345
|
chris@37
|
346 end
|
Chris@0
|
347
|
Chris@0
|
348 def test_not_found
|
chris@37
|
349 get :show, :project_id => 999
|
Chris@0
|
350 assert_response 404
|
Chris@0
|
351 end
|
Chris@0
|
352
|
Chris@0
|
353 def test_protect_page
|
Chris@0
|
354 page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page')
|
Chris@0
|
355 assert !page.protected?
|
Chris@0
|
356 @request.session[:user_id] = 2
|
chris@37
|
357 post :protect, :project_id => 1, :id => page.title, :protected => '1'
|
chris@37
|
358 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page'
|
Chris@0
|
359 assert page.reload.protected?
|
Chris@0
|
360 end
|
Chris@0
|
361
|
Chris@0
|
362 def test_unprotect_page
|
Chris@0
|
363 page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation')
|
Chris@0
|
364 assert page.protected?
|
Chris@0
|
365 @request.session[:user_id] = 2
|
chris@37
|
366 post :protect, :project_id => 1, :id => page.title, :protected => '0'
|
chris@37
|
367 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'CookBook_documentation'
|
Chris@0
|
368 assert !page.reload.protected?
|
Chris@0
|
369 end
|
Chris@0
|
370
|
Chris@0
|
371 def test_show_page_with_edit_link
|
Chris@0
|
372 @request.session[:user_id] = 2
|
chris@37
|
373 get :show, :project_id => 1
|
Chris@0
|
374 assert_response :success
|
Chris@0
|
375 assert_template 'show'
|
Chris@0
|
376 assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' }
|
Chris@0
|
377 end
|
Chris@0
|
378
|
Chris@0
|
379 def test_show_page_without_edit_link
|
Chris@0
|
380 @request.session[:user_id] = 4
|
chris@37
|
381 get :show, :project_id => 1
|
Chris@0
|
382 assert_response :success
|
Chris@0
|
383 assert_template 'show'
|
Chris@0
|
384 assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' }
|
Chris@0
|
385 end
|
Chris@0
|
386
|
Chris@0
|
387 def test_edit_unprotected_page
|
Chris@0
|
388 # Non members can edit unprotected wiki pages
|
Chris@0
|
389 @request.session[:user_id] = 4
|
chris@37
|
390 get :edit, :project_id => 1, :id => 'Another_page'
|
Chris@0
|
391 assert_response :success
|
Chris@0
|
392 assert_template 'edit'
|
Chris@0
|
393 end
|
Chris@0
|
394
|
Chris@0
|
395 def test_edit_protected_page_by_nonmember
|
Chris@0
|
396 # Non members can't edit protected wiki pages
|
Chris@0
|
397 @request.session[:user_id] = 4
|
chris@37
|
398 get :edit, :project_id => 1, :id => 'CookBook_documentation'
|
Chris@0
|
399 assert_response 403
|
Chris@0
|
400 end
|
Chris@0
|
401
|
Chris@0
|
402 def test_edit_protected_page_by_member
|
Chris@0
|
403 @request.session[:user_id] = 2
|
chris@37
|
404 get :edit, :project_id => 1, :id => 'CookBook_documentation'
|
Chris@0
|
405 assert_response :success
|
Chris@0
|
406 assert_template 'edit'
|
Chris@0
|
407 end
|
Chris@0
|
408
|
Chris@0
|
409 def test_history_of_non_existing_page_should_return_404
|
chris@37
|
410 get :history, :project_id => 1, :id => 'Unknown_page'
|
Chris@0
|
411 assert_response 404
|
Chris@0
|
412 end
|
Chris@0
|
413 end
|