@@ -1,853 +1,858 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../test_helper', __FILE__) |
|
19 | 19 | require 'wiki_controller' |
|
20 | 20 | |
|
21 | 21 | # Re-raise errors caught by the controller. |
|
22 | 22 | class WikiController; def rescue_action(e) raise e end; end |
|
23 | 23 | |
|
24 | 24 | class WikiControllerTest < ActionController::TestCase |
|
25 | 25 | fixtures :projects, :users, :roles, :members, :member_roles, |
|
26 | 26 | :enabled_modules, :wikis, :wiki_pages, :wiki_contents, |
|
27 | 27 | :wiki_content_versions, :attachments |
|
28 | 28 | |
|
29 | 29 | def setup |
|
30 | 30 | @controller = WikiController.new |
|
31 | 31 | @request = ActionController::TestRequest.new |
|
32 | 32 | @response = ActionController::TestResponse.new |
|
33 | 33 | User.current = nil |
|
34 | 34 | end |
|
35 | 35 | |
|
36 | 36 | def test_show_start_page |
|
37 | 37 | get :show, :project_id => 'ecookbook' |
|
38 | 38 | assert_response :success |
|
39 | 39 | assert_template 'show' |
|
40 | 40 | assert_tag :tag => 'h1', :content => /CookBook documentation/ |
|
41 | 41 | |
|
42 | 42 | # child_pages macro |
|
43 | 43 | assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, |
|
44 | 44 | :child => { :tag => 'li', |
|
45 | 45 | :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, |
|
46 | 46 | :content => 'Page with an inline image' } } |
|
47 | 47 | end |
|
48 | 48 | |
|
49 | 49 | def test_export_link |
|
50 | 50 | Role.anonymous.add_permission! :export_wiki_pages |
|
51 | 51 | get :show, :project_id => 'ecookbook' |
|
52 | 52 | assert_response :success |
|
53 | 53 | assert_tag 'a', :attributes => {:href => '/projects/ecookbook/wiki/CookBook_documentation.txt'} |
|
54 | 54 | end |
|
55 | 55 | |
|
56 | 56 | def test_show_page_with_name |
|
57 | 57 | get :show, :project_id => 1, :id => 'Another_page' |
|
58 | 58 | assert_response :success |
|
59 | 59 | assert_template 'show' |
|
60 | 60 | assert_tag :tag => 'h1', :content => /Another page/ |
|
61 | 61 | # Included page with an inline image |
|
62 | 62 | assert_tag :tag => 'p', :content => /This is an inline image/ |
|
63 | 63 | assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3', |
|
64 | 64 | :alt => 'This is a logo' } |
|
65 | 65 | end |
|
66 | 66 | |
|
67 | 67 | def test_show_redirected_page |
|
68 | 68 | WikiRedirect.create!(:wiki_id => 1, :title => 'Old_title', :redirects_to => 'Another_page') |
|
69 | 69 | |
|
70 | 70 | get :show, :project_id => 'ecookbook', :id => 'Old_title' |
|
71 | 71 | assert_redirected_to '/projects/ecookbook/wiki/Another_page' |
|
72 | 72 | end |
|
73 | 73 | |
|
74 | 74 | def test_show_with_sidebar |
|
75 | 75 | page = Project.find(1).wiki.pages.new(:title => 'Sidebar') |
|
76 | 76 | page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar') |
|
77 | 77 | page.save! |
|
78 | 78 | |
|
79 | 79 | get :show, :project_id => 1, :id => 'Another_page' |
|
80 | 80 | assert_response :success |
|
81 | 81 | assert_tag :tag => 'div', :attributes => {:id => 'sidebar'}, |
|
82 | 82 | :content => /Side bar content for test_show_with_sidebar/ |
|
83 | 83 | end |
|
84 | 84 | |
|
85 | 85 | def test_show_should_display_section_edit_links |
|
86 | 86 | @request.session[:user_id] = 2 |
|
87 | 87 | get :show, :project_id => 1, :id => 'Page with sections' |
|
88 | 88 | assert_no_tag 'a', :attributes => { |
|
89 | 89 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=1' |
|
90 | 90 | } |
|
91 | 91 | assert_tag 'a', :attributes => { |
|
92 | 92 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=2' |
|
93 | 93 | } |
|
94 | 94 | assert_tag 'a', :attributes => { |
|
95 | 95 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=3' |
|
96 | 96 | } |
|
97 | 97 | end |
|
98 | 98 | |
|
99 | 99 | def test_show_current_version_should_display_section_edit_links |
|
100 | 100 | @request.session[:user_id] = 2 |
|
101 | 101 | get :show, :project_id => 1, :id => 'Page with sections', :version => 3 |
|
102 | 102 | |
|
103 | 103 | assert_tag 'a', :attributes => { |
|
104 | 104 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=2' |
|
105 | 105 | } |
|
106 | 106 | end |
|
107 | 107 | |
|
108 | 108 | def test_show_old_version_should_not_display_section_edit_links |
|
109 | 109 | @request.session[:user_id] = 2 |
|
110 | 110 | get :show, :project_id => 1, :id => 'Page with sections', :version => 2 |
|
111 | 111 | |
|
112 | 112 | assert_no_tag 'a', :attributes => { |
|
113 | 113 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=2' |
|
114 | 114 | } |
|
115 | 115 | end |
|
116 | 116 | |
|
117 | 117 | def test_show_unexistent_page_without_edit_right |
|
118 | 118 | get :show, :project_id => 1, :id => 'Unexistent page' |
|
119 | 119 | assert_response 404 |
|
120 | 120 | end |
|
121 | 121 | |
|
122 | 122 | def test_show_unexistent_page_with_edit_right |
|
123 | 123 | @request.session[:user_id] = 2 |
|
124 | 124 | get :show, :project_id => 1, :id => 'Unexistent page' |
|
125 | 125 | assert_response :success |
|
126 | 126 | assert_template 'edit' |
|
127 | 127 | end |
|
128 | 128 | |
|
129 | 129 | def test_show_unexistent_page_with_parent_should_preselect_parent |
|
130 | 130 | @request.session[:user_id] = 2 |
|
131 | 131 | get :show, :project_id => 1, :id => 'Unexistent page', :parent => 'Another_page' |
|
132 | 132 | assert_response :success |
|
133 | 133 | assert_template 'edit' |
|
134 | 134 | assert_tag 'select', :attributes => {:name => 'wiki_page[parent_id]'}, |
|
135 | 135 | :child => {:tag => 'option', :attributes => {:value => '2', :selected => 'selected'}} |
|
136 | 136 | end |
|
137 | 137 | |
|
138 | 138 | def test_show_should_not_show_history_without_permission |
|
139 | 139 | Role.anonymous.remove_permission! :view_wiki_edits |
|
140 | 140 | get :show, :project_id => 1, :id => 'Page with sections', :version => 2 |
|
141 | 141 | |
|
142 | 142 | assert_response 302 |
|
143 | 143 | end |
|
144 | 144 | |
|
145 | 145 | def test_create_page |
|
146 | 146 | @request.session[:user_id] = 2 |
|
147 | 147 | assert_difference 'WikiPage.count' do |
|
148 | 148 | assert_difference 'WikiContent.count' do |
|
149 | 149 | put :update, :project_id => 1, |
|
150 | 150 | :id => 'New page', |
|
151 | 151 | :content => {:comments => 'Created the page', |
|
152 | 152 | :text => "h1. New page\n\nThis is a new page", |
|
153 | 153 | :version => 0} |
|
154 | 154 | end |
|
155 | 155 | end |
|
156 | 156 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'New_page' |
|
157 | 157 | page = Project.find(1).wiki.find_page('New page') |
|
158 | 158 | assert !page.new_record? |
|
159 | 159 | assert_not_nil page.content |
|
160 | 160 | assert_nil page.parent |
|
161 | 161 | assert_equal 'Created the page', page.content.comments |
|
162 | 162 | end |
|
163 | 163 | |
|
164 | 164 | def test_create_page_with_attachments |
|
165 | 165 | @request.session[:user_id] = 2 |
|
166 | 166 | assert_difference 'WikiPage.count' do |
|
167 | 167 | assert_difference 'Attachment.count' do |
|
168 | 168 | put :update, :project_id => 1, |
|
169 | 169 | :id => 'New page', |
|
170 | 170 | :content => {:comments => 'Created the page', |
|
171 | 171 | :text => "h1. New page\n\nThis is a new page", |
|
172 | 172 | :version => 0}, |
|
173 | 173 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} |
|
174 | 174 | end |
|
175 | 175 | end |
|
176 | 176 | page = Project.find(1).wiki.find_page('New page') |
|
177 | 177 | assert_equal 1, page.attachments.count |
|
178 | 178 | assert_equal 'testfile.txt', page.attachments.first.filename |
|
179 | 179 | end |
|
180 | 180 | |
|
181 | 181 | def test_create_page_with_parent |
|
182 | 182 | @request.session[:user_id] = 2 |
|
183 | 183 | assert_difference 'WikiPage.count' do |
|
184 | 184 | put :update, :project_id => 1, :id => 'New page', |
|
185 | 185 | :content => {:text => "h1. New page\n\nThis is a new page", :version => 0}, |
|
186 | 186 | :wiki_page => {:parent_id => 2} |
|
187 | 187 | end |
|
188 | 188 | page = Project.find(1).wiki.find_page('New page') |
|
189 | 189 | assert_equal WikiPage.find(2), page.parent |
|
190 | 190 | end |
|
191 | 191 | |
|
192 | 192 | def test_edit_page |
|
193 | 193 | @request.session[:user_id] = 2 |
|
194 | 194 | get :edit, :project_id => 'ecookbook', :id => 'Another_page' |
|
195 | 195 | |
|
196 | 196 | assert_response :success |
|
197 | 197 | assert_template 'edit' |
|
198 | 198 | |
|
199 | 199 | assert_tag 'textarea', |
|
200 | 200 | :attributes => { :name => 'content[text]' }, |
|
201 | 201 | :content => "\n"+WikiPage.find_by_title('Another_page').content.text |
|
202 | 202 | end |
|
203 | 203 | |
|
204 | 204 | def test_edit_section |
|
205 | 205 | @request.session[:user_id] = 2 |
|
206 | 206 | get :edit, :project_id => 'ecookbook', :id => 'Page_with_sections', :section => 2 |
|
207 | 207 | |
|
208 | 208 | assert_response :success |
|
209 | 209 | assert_template 'edit' |
|
210 | 210 | |
|
211 | 211 | page = WikiPage.find_by_title('Page_with_sections') |
|
212 | 212 | section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) |
|
213 | 213 | |
|
214 | 214 | assert_tag 'textarea', |
|
215 | 215 | :attributes => { :name => 'content[text]' }, |
|
216 | 216 | :content => "\n"+section |
|
217 | 217 | assert_tag 'input', |
|
218 | 218 | :attributes => { :name => 'section', :type => 'hidden', :value => '2' } |
|
219 | 219 | assert_tag 'input', |
|
220 | 220 | :attributes => { :name => 'section_hash', :type => 'hidden', :value => hash } |
|
221 | 221 | end |
|
222 | 222 | |
|
223 | 223 | def test_edit_invalid_section_should_respond_with_404 |
|
224 | 224 | @request.session[:user_id] = 2 |
|
225 | 225 | get :edit, :project_id => 'ecookbook', :id => 'Page_with_sections', :section => 10 |
|
226 | 226 | |
|
227 | 227 | assert_response 404 |
|
228 | 228 | end |
|
229 | 229 | |
|
230 | 230 | def test_update_page |
|
231 | 231 | @request.session[:user_id] = 2 |
|
232 | 232 | assert_no_difference 'WikiPage.count' do |
|
233 | 233 | assert_no_difference 'WikiContent.count' do |
|
234 | 234 | assert_difference 'WikiContent::Version.count' do |
|
235 | 235 | put :update, :project_id => 1, |
|
236 | 236 | :id => 'Another_page', |
|
237 | 237 | :content => { |
|
238 | 238 | :comments => "my comments", |
|
239 | 239 | :text => "edited", |
|
240 | 240 | :version => 1 |
|
241 | 241 | } |
|
242 | 242 | end |
|
243 | 243 | end |
|
244 | 244 | end |
|
245 | 245 | assert_redirected_to '/projects/ecookbook/wiki/Another_page' |
|
246 | 246 | |
|
247 | 247 | page = Wiki.find(1).pages.find_by_title('Another_page') |
|
248 | 248 | assert_equal "edited", page.content.text |
|
249 | 249 | assert_equal 2, page.content.version |
|
250 | 250 | assert_equal "my comments", page.content.comments |
|
251 | 251 | end |
|
252 | 252 | |
|
253 | 253 | def test_update_page_with_parent |
|
254 | 254 | @request.session[:user_id] = 2 |
|
255 | 255 | assert_no_difference 'WikiPage.count' do |
|
256 | 256 | assert_no_difference 'WikiContent.count' do |
|
257 | 257 | assert_difference 'WikiContent::Version.count' do |
|
258 | 258 | put :update, :project_id => 1, |
|
259 | 259 | :id => 'Another_page', |
|
260 | 260 | :content => { |
|
261 | 261 | :comments => "my comments", |
|
262 | 262 | :text => "edited", |
|
263 | 263 | :version => 1 |
|
264 | 264 | }, |
|
265 | 265 | :wiki_page => {:parent_id => '1'} |
|
266 | 266 | end |
|
267 | 267 | end |
|
268 | 268 | end |
|
269 | 269 | assert_redirected_to '/projects/ecookbook/wiki/Another_page' |
|
270 | 270 | |
|
271 | 271 | page = Wiki.find(1).pages.find_by_title('Another_page') |
|
272 | 272 | assert_equal "edited", page.content.text |
|
273 | 273 | assert_equal 2, page.content.version |
|
274 | 274 | assert_equal "my comments", page.content.comments |
|
275 | 275 | assert_equal WikiPage.find(1), page.parent |
|
276 | 276 | end |
|
277 | 277 | |
|
278 | 278 | def test_update_page_with_failure |
|
279 | 279 | @request.session[:user_id] = 2 |
|
280 | 280 | assert_no_difference 'WikiPage.count' do |
|
281 | 281 | assert_no_difference 'WikiContent.count' do |
|
282 | 282 | assert_no_difference 'WikiContent::Version.count' do |
|
283 | 283 | put :update, :project_id => 1, |
|
284 | 284 | :id => 'Another_page', |
|
285 | 285 | :content => { |
|
286 | 286 | :comments => 'a' * 300, # failure here, comment is too long |
|
287 | 287 | :text => 'edited', |
|
288 | 288 | :version => 1 |
|
289 | 289 | } |
|
290 | 290 | end |
|
291 | 291 | end |
|
292 | 292 | end |
|
293 | 293 | assert_response :success |
|
294 | 294 | assert_template 'edit' |
|
295 | 295 | |
|
296 | 296 | assert_error_tag :descendant => {:content => /Comment is too long/} |
|
297 | 297 | assert_tag :tag => 'textarea', :attributes => {:id => 'content_text'}, :content => "\nedited" |
|
298 | 298 | assert_tag :tag => 'input', :attributes => {:id => 'content_version', :value => '1'} |
|
299 | 299 | end |
|
300 | 300 | |
|
301 | 301 | def test_update_page_with_parent_change_only_should_not_create_content_version |
|
302 | 302 | @request.session[:user_id] = 2 |
|
303 | 303 | assert_no_difference 'WikiPage.count' do |
|
304 | 304 | assert_no_difference 'WikiContent.count' do |
|
305 | 305 | assert_no_difference 'WikiContent::Version.count' do |
|
306 | 306 | put :update, :project_id => 1, |
|
307 | 307 | :id => 'Another_page', |
|
308 | 308 | :content => { |
|
309 | 309 | :comments => '', |
|
310 | 310 | :text => Wiki.find(1).find_page('Another_page').content.text, |
|
311 | 311 | :version => 1 |
|
312 | 312 | }, |
|
313 | 313 | :wiki_page => {:parent_id => '1'} |
|
314 | 314 | end |
|
315 | 315 | end |
|
316 | 316 | end |
|
317 | 317 | page = Wiki.find(1).pages.find_by_title('Another_page') |
|
318 | 318 | assert_equal 1, page.content.version |
|
319 | 319 | assert_equal WikiPage.find(1), page.parent |
|
320 | 320 | end |
|
321 | 321 | |
|
322 | 322 | def test_update_page_with_attachments_only_should_not_create_content_version |
|
323 | 323 | @request.session[:user_id] = 2 |
|
324 | 324 | assert_no_difference 'WikiPage.count' do |
|
325 | 325 | assert_no_difference 'WikiContent.count' do |
|
326 | 326 | assert_no_difference 'WikiContent::Version.count' do |
|
327 | 327 | assert_difference 'Attachment.count' do |
|
328 | 328 | put :update, :project_id => 1, |
|
329 | 329 | :id => 'Another_page', |
|
330 | 330 | :content => { |
|
331 | 331 | :comments => '', |
|
332 | 332 | :text => Wiki.find(1).find_page('Another_page').content.text, |
|
333 | 333 | :version => 1 |
|
334 | 334 | }, |
|
335 | 335 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}} |
|
336 | 336 | end |
|
337 | 337 | end |
|
338 | 338 | end |
|
339 | 339 | end |
|
340 | 340 | page = Wiki.find(1).pages.find_by_title('Another_page') |
|
341 | 341 | assert_equal 1, page.content.version |
|
342 | 342 | end |
|
343 | 343 | |
|
344 | 344 | def test_update_stale_page_should_not_raise_an_error |
|
345 | 345 | @request.session[:user_id] = 2 |
|
346 | 346 | c = Wiki.find(1).find_page('Another_page').content |
|
347 | 347 | c.text = 'Previous text' |
|
348 | 348 | c.save! |
|
349 | 349 | assert_equal 2, c.version |
|
350 | 350 | |
|
351 | 351 | assert_no_difference 'WikiPage.count' do |
|
352 | 352 | assert_no_difference 'WikiContent.count' do |
|
353 | 353 | assert_no_difference 'WikiContent::Version.count' do |
|
354 | 354 | put :update, :project_id => 1, |
|
355 | 355 | :id => 'Another_page', |
|
356 | 356 | :content => { |
|
357 | 357 | :comments => 'My comments', |
|
358 | 358 | :text => 'Text should not be lost', |
|
359 | 359 | :version => 1 |
|
360 | 360 | } |
|
361 | 361 | end |
|
362 | 362 | end |
|
363 | 363 | end |
|
364 | 364 | assert_response :success |
|
365 | 365 | assert_template 'edit' |
|
366 | 366 | assert_tag :div, |
|
367 | 367 | :attributes => { :class => /error/ }, |
|
368 | 368 | :content => /Data has been updated by another user/ |
|
369 | 369 | assert_tag 'textarea', |
|
370 | 370 | :attributes => { :name => 'content[text]' }, |
|
371 | 371 | :content => /Text should not be lost/ |
|
372 | 372 | assert_tag 'input', |
|
373 | 373 | :attributes => { :name => 'content[comments]', :value => 'My comments' } |
|
374 | 374 | |
|
375 | 375 | c.reload |
|
376 | 376 | assert_equal 'Previous text', c.text |
|
377 | 377 | assert_equal 2, c.version |
|
378 | 378 | end |
|
379 | 379 | |
|
380 | 380 | def test_update_section |
|
381 | 381 | @request.session[:user_id] = 2 |
|
382 | 382 | page = WikiPage.find_by_title('Page_with_sections') |
|
383 | 383 | section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) |
|
384 | 384 | text = page.content.text |
|
385 | 385 | |
|
386 | 386 | assert_no_difference 'WikiPage.count' do |
|
387 | 387 | assert_no_difference 'WikiContent.count' do |
|
388 | 388 | assert_difference 'WikiContent::Version.count' do |
|
389 | 389 | put :update, :project_id => 1, :id => 'Page_with_sections', |
|
390 | 390 | :content => { |
|
391 | 391 | :text => "New section content", |
|
392 | 392 | :version => 3 |
|
393 | 393 | }, |
|
394 | 394 | :section => 2, |
|
395 | 395 | :section_hash => hash |
|
396 | 396 | end |
|
397 | 397 | end |
|
398 | 398 | end |
|
399 | 399 | assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections' |
|
400 | 400 | assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, "New section content"), page.reload.content.text |
|
401 | 401 | end |
|
402 | 402 | |
|
403 | 403 | def test_update_section_should_allow_stale_page_update |
|
404 | 404 | @request.session[:user_id] = 2 |
|
405 | 405 | page = WikiPage.find_by_title('Page_with_sections') |
|
406 | 406 | section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) |
|
407 | 407 | text = page.content.text |
|
408 | 408 | |
|
409 | 409 | assert_no_difference 'WikiPage.count' do |
|
410 | 410 | assert_no_difference 'WikiContent.count' do |
|
411 | 411 | assert_difference 'WikiContent::Version.count' do |
|
412 | 412 | put :update, :project_id => 1, :id => 'Page_with_sections', |
|
413 | 413 | :content => { |
|
414 | 414 | :text => "New section content", |
|
415 | 415 | :version => 2 # Current version is 3 |
|
416 | 416 | }, |
|
417 | 417 | :section => 2, |
|
418 | 418 | :section_hash => hash |
|
419 | 419 | end |
|
420 | 420 | end |
|
421 | 421 | end |
|
422 | 422 | assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections' |
|
423 | 423 | page.reload |
|
424 | 424 | assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, "New section content"), page.content.text |
|
425 | 425 | assert_equal 4, page.content.version |
|
426 | 426 | end |
|
427 | 427 | |
|
428 | 428 | def test_update_section_should_not_allow_stale_section_update |
|
429 | 429 | @request.session[:user_id] = 2 |
|
430 | 430 | |
|
431 | 431 | assert_no_difference 'WikiPage.count' do |
|
432 | 432 | assert_no_difference 'WikiContent.count' do |
|
433 | 433 | assert_no_difference 'WikiContent::Version.count' do |
|
434 | 434 | put :update, :project_id => 1, :id => 'Page_with_sections', |
|
435 | 435 | :content => { |
|
436 | 436 | :comments => 'My comments', |
|
437 | 437 | :text => "Text should not be lost", |
|
438 | 438 | :version => 3 |
|
439 | 439 | }, |
|
440 | 440 | :section => 2, |
|
441 | 441 | :section_hash => Digest::MD5.hexdigest("wrong hash") |
|
442 | 442 | end |
|
443 | 443 | end |
|
444 | 444 | end |
|
445 | 445 | assert_response :success |
|
446 | 446 | assert_template 'edit' |
|
447 | 447 | assert_tag :div, |
|
448 | 448 | :attributes => { :class => /error/ }, |
|
449 | 449 | :content => /Data has been updated by another user/ |
|
450 | 450 | assert_tag 'textarea', |
|
451 | 451 | :attributes => { :name => 'content[text]' }, |
|
452 | 452 | :content => /Text should not be lost/ |
|
453 | 453 | assert_tag 'input', |
|
454 | 454 | :attributes => { :name => 'content[comments]', :value => 'My comments' } |
|
455 | 455 | end |
|
456 | 456 | |
|
457 | 457 | def test_preview |
|
458 | 458 | @request.session[:user_id] = 2 |
|
459 | 459 | xhr :post, :preview, :project_id => 1, :id => 'CookBook_documentation', |
|
460 | 460 | :content => { :comments => '', |
|
461 | 461 | :text => 'this is a *previewed text*', |
|
462 | 462 | :version => 3 } |
|
463 | 463 | assert_response :success |
|
464 | 464 | assert_template 'common/_preview' |
|
465 | 465 | assert_tag :tag => 'strong', :content => /previewed text/ |
|
466 | 466 | end |
|
467 | 467 | |
|
468 | 468 | def test_preview_new_page |
|
469 | 469 | @request.session[:user_id] = 2 |
|
470 | 470 | xhr :post, :preview, :project_id => 1, :id => 'New page', |
|
471 | 471 | :content => { :text => 'h1. New page', |
|
472 | 472 | :comments => '', |
|
473 | 473 | :version => 0 } |
|
474 | 474 | assert_response :success |
|
475 | 475 | assert_template 'common/_preview' |
|
476 | 476 | assert_tag :tag => 'h1', :content => /New page/ |
|
477 | 477 | end |
|
478 | 478 | |
|
479 | 479 | def test_history |
|
480 | 480 | get :history, :project_id => 1, :id => 'CookBook_documentation' |
|
481 | 481 | assert_response :success |
|
482 | 482 | assert_template 'history' |
|
483 | 483 | assert_not_nil assigns(:versions) |
|
484 | 484 | assert_equal 3, assigns(:versions).size |
|
485 | 485 | assert_select "input[type=submit][name=commit]" |
|
486 | 486 | end |
|
487 | 487 | |
|
488 | 488 | def test_history_with_one_version |
|
489 | 489 | get :history, :project_id => 1, :id => 'Another_page' |
|
490 | 490 | assert_response :success |
|
491 | 491 | assert_template 'history' |
|
492 | 492 | assert_not_nil assigns(:versions) |
|
493 | 493 | assert_equal 1, assigns(:versions).size |
|
494 | 494 | assert_select "input[type=submit][name=commit]", false |
|
495 | 495 | end |
|
496 | 496 | |
|
497 | 497 | def test_diff |
|
498 | 498 | content = WikiPage.find(1).content |
|
499 | 499 | assert_difference 'WikiContent::Version.count', 2 do |
|
500 | 500 | content.text = "Line removed\nThis is a sample text for testing diffs" |
|
501 | 501 | content.save! |
|
502 | 502 | content.text = "This is a sample text for testing diffs\nLine added" |
|
503 | 503 | content.save! |
|
504 | 504 | end |
|
505 | 505 | |
|
506 | 506 | get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => content.version, :version_from => (content.version - 1) |
|
507 | 507 | assert_response :success |
|
508 | 508 | assert_template 'diff' |
|
509 | 509 | assert_select 'span.diff_out', :text => 'Line removed' |
|
510 | 510 | assert_select 'span.diff_in', :text => 'Line added' |
|
511 | 511 | end |
|
512 | 512 | |
|
513 | 513 | def test_annotate |
|
514 | 514 | get :annotate, :project_id => 1, :id => 'CookBook_documentation', :version => 2 |
|
515 | 515 | assert_response :success |
|
516 | 516 | assert_template 'annotate' |
|
517 | 517 | |
|
518 | 518 | # Line 1 |
|
519 | 519 | assert_tag :tag => 'tr', :child => { |
|
520 | 520 | :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1', :sibling => { |
|
521 | 521 | :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/, :sibling => { |
|
522 | 522 | :tag => 'td', :content => /h1\. CookBook documentation/ |
|
523 | 523 | } |
|
524 | 524 | } |
|
525 | 525 | } |
|
526 | 526 | |
|
527 | 527 | # Line 5 |
|
528 | 528 | assert_tag :tag => 'tr', :child => { |
|
529 | 529 | :tag => 'th', :attributes => {:class => 'line-num'}, :content => '5', :sibling => { |
|
530 | 530 | :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/, :sibling => { |
|
531 | 531 | :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ |
|
532 | 532 | } |
|
533 | 533 | } |
|
534 | 534 | } |
|
535 | 535 | end |
|
536 | 536 | |
|
537 | 537 | def test_get_rename |
|
538 | 538 | @request.session[:user_id] = 2 |
|
539 | 539 | get :rename, :project_id => 1, :id => 'Another_page' |
|
540 | 540 | assert_response :success |
|
541 | 541 | assert_template 'rename' |
|
542 | 542 | assert_tag 'option', |
|
543 | 543 | :attributes => {:value => ''}, |
|
544 | 544 | :content => '', |
|
545 | 545 | :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}} |
|
546 | 546 | assert_no_tag 'option', |
|
547 | 547 | :attributes => {:selected => 'selected'}, |
|
548 | 548 | :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}} |
|
549 | 549 | end |
|
550 | 550 | |
|
551 | 551 | def test_get_rename_child_page |
|
552 | 552 | @request.session[:user_id] = 2 |
|
553 | 553 | get :rename, :project_id => 1, :id => 'Child_1' |
|
554 | 554 | assert_response :success |
|
555 | 555 | assert_template 'rename' |
|
556 | 556 | assert_tag 'option', |
|
557 | 557 | :attributes => {:value => ''}, |
|
558 | 558 | :content => '', |
|
559 | 559 | :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}} |
|
560 | 560 | assert_tag 'option', |
|
561 | 561 | :attributes => {:value => '2', :selected => 'selected'}, |
|
562 | 562 | :content => /Another page/, |
|
563 | 563 | :parent => { |
|
564 | 564 | :tag => 'select', |
|
565 | 565 | :attributes => {:name => 'wiki_page[parent_id]'} |
|
566 | 566 | } |
|
567 | 567 | end |
|
568 | 568 | |
|
569 | 569 | def test_rename_with_redirect |
|
570 | 570 | @request.session[:user_id] = 2 |
|
571 | 571 | post :rename, :project_id => 1, :id => 'Another_page', |
|
572 | 572 | :wiki_page => { :title => 'Another renamed page', |
|
573 | 573 | :redirect_existing_links => 1 } |
|
574 | 574 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page' |
|
575 | 575 | wiki = Project.find(1).wiki |
|
576 | 576 | # Check redirects |
|
577 | 577 | assert_not_nil wiki.find_page('Another page') |
|
578 | 578 | assert_nil wiki.find_page('Another page', :with_redirect => false) |
|
579 | 579 | end |
|
580 | 580 | |
|
581 | 581 | def test_rename_without_redirect |
|
582 | 582 | @request.session[:user_id] = 2 |
|
583 | 583 | post :rename, :project_id => 1, :id => 'Another_page', |
|
584 | 584 | :wiki_page => { :title => 'Another renamed page', |
|
585 | 585 | :redirect_existing_links => "0" } |
|
586 | 586 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page' |
|
587 | 587 | wiki = Project.find(1).wiki |
|
588 | 588 | # Check that there's no redirects |
|
589 | 589 | assert_nil wiki.find_page('Another page') |
|
590 | 590 | end |
|
591 | 591 | |
|
592 | 592 | def test_rename_with_parent_assignment |
|
593 | 593 | @request.session[:user_id] = 2 |
|
594 | 594 | post :rename, :project_id => 1, :id => 'Another_page', |
|
595 | 595 | :wiki_page => { :title => 'Another page', :redirect_existing_links => "0", :parent_id => '4' } |
|
596 | 596 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page' |
|
597 | 597 | assert_equal WikiPage.find(4), WikiPage.find_by_title('Another_page').parent |
|
598 | 598 | end |
|
599 | 599 | |
|
600 | 600 | def test_rename_with_parent_unassignment |
|
601 | 601 | @request.session[:user_id] = 2 |
|
602 | 602 | post :rename, :project_id => 1, :id => 'Child_1', |
|
603 | 603 | :wiki_page => { :title => 'Child 1', :redirect_existing_links => "0", :parent_id => '' } |
|
604 | 604 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Child_1' |
|
605 | 605 | assert_nil WikiPage.find_by_title('Child_1').parent |
|
606 | 606 | end |
|
607 | 607 | |
|
608 | 608 | def test_destroy_a_page_without_children_should_not_ask_confirmation |
|
609 | 609 | @request.session[:user_id] = 2 |
|
610 | 610 | delete :destroy, :project_id => 1, :id => 'Child_2' |
|
611 | 611 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
612 | 612 | end |
|
613 | 613 | |
|
614 | 614 | def test_destroy_parent_should_ask_confirmation |
|
615 | 615 | @request.session[:user_id] = 2 |
|
616 | 616 | assert_no_difference('WikiPage.count') do |
|
617 | 617 | delete :destroy, :project_id => 1, :id => 'Another_page' |
|
618 | 618 | end |
|
619 | 619 | assert_response :success |
|
620 | 620 | assert_template 'destroy' |
|
621 | assert_select 'form' do | |
|
622 | assert_select 'input[name=todo][value=nullify]' | |
|
623 | assert_select 'input[name=todo][value=destroy]' | |
|
624 | assert_select 'input[name=todo][value=reassign]' | |
|
625 | end | |
|
621 | 626 | end |
|
622 | 627 | |
|
623 | 628 | def test_destroy_parent_with_nullify_should_delete_parent_only |
|
624 | 629 | @request.session[:user_id] = 2 |
|
625 | 630 | assert_difference('WikiPage.count', -1) do |
|
626 | 631 | delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'nullify' |
|
627 | 632 | end |
|
628 | 633 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
629 | 634 | assert_nil WikiPage.find_by_id(2) |
|
630 | 635 | end |
|
631 | 636 | |
|
632 | 637 | def test_destroy_parent_with_cascade_should_delete_descendants |
|
633 | 638 | @request.session[:user_id] = 2 |
|
634 | 639 | assert_difference('WikiPage.count', -4) do |
|
635 | 640 | delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'destroy' |
|
636 | 641 | end |
|
637 | 642 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
638 | 643 | assert_nil WikiPage.find_by_id(2) |
|
639 | 644 | assert_nil WikiPage.find_by_id(5) |
|
640 | 645 | end |
|
641 | 646 | |
|
642 | 647 | def test_destroy_parent_with_reassign |
|
643 | 648 | @request.session[:user_id] = 2 |
|
644 | 649 | assert_difference('WikiPage.count', -1) do |
|
645 | 650 | delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'reassign', :reassign_to_id => 1 |
|
646 | 651 | end |
|
647 | 652 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
648 | 653 | assert_nil WikiPage.find_by_id(2) |
|
649 | 654 | assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent |
|
650 | 655 | end |
|
651 | 656 | |
|
652 | 657 | def test_index |
|
653 | 658 | get :index, :project_id => 'ecookbook' |
|
654 | 659 | assert_response :success |
|
655 | 660 | assert_template 'index' |
|
656 | 661 | pages = assigns(:pages) |
|
657 | 662 | assert_not_nil pages |
|
658 | 663 | assert_equal Project.find(1).wiki.pages.size, pages.size |
|
659 | 664 | assert_equal pages.first.content.updated_on, pages.first.updated_on |
|
660 | 665 | |
|
661 | 666 | assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, |
|
662 | 667 | :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/CookBook_documentation' }, |
|
663 | 668 | :content => 'CookBook documentation' }, |
|
664 | 669 | :child => { :tag => 'ul', |
|
665 | 670 | :child => { :tag => 'li', |
|
666 | 671 | :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, |
|
667 | 672 | :content => 'Page with an inline image' } } } }, |
|
668 | 673 | :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' }, |
|
669 | 674 | :content => 'Another page' } } |
|
670 | 675 | end |
|
671 | 676 | |
|
672 | 677 | def test_index_should_include_atom_link |
|
673 | 678 | get :index, :project_id => 'ecookbook' |
|
674 | 679 | assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} |
|
675 | 680 | end |
|
676 | 681 | |
|
677 | 682 | def test_export_to_html |
|
678 | 683 | @request.session[:user_id] = 2 |
|
679 | 684 | get :export, :project_id => 'ecookbook' |
|
680 | 685 | |
|
681 | 686 | assert_response :success |
|
682 | 687 | assert_not_nil assigns(:pages) |
|
683 | 688 | assert assigns(:pages).any? |
|
684 | 689 | assert_equal "text/html", @response.content_type |
|
685 | 690 | |
|
686 | 691 | assert_select "a[name=?]", "CookBook_documentation" |
|
687 | 692 | assert_select "a[name=?]", "Another_page" |
|
688 | 693 | assert_select "a[name=?]", "Page_with_an_inline_image" |
|
689 | 694 | end |
|
690 | 695 | |
|
691 | 696 | def test_export_to_pdf |
|
692 | 697 | @request.session[:user_id] = 2 |
|
693 | 698 | get :export, :project_id => 'ecookbook', :format => 'pdf' |
|
694 | 699 | |
|
695 | 700 | assert_response :success |
|
696 | 701 | assert_not_nil assigns(:pages) |
|
697 | 702 | assert assigns(:pages).any? |
|
698 | 703 | assert_equal 'application/pdf', @response.content_type |
|
699 | 704 | assert_equal 'attachment; filename="ecookbook.pdf"', @response.headers['Content-Disposition'] |
|
700 | 705 | assert @response.body.starts_with?('%PDF') |
|
701 | 706 | end |
|
702 | 707 | |
|
703 | 708 | def test_export_without_permission_should_be_denied |
|
704 | 709 | @request.session[:user_id] = 2 |
|
705 | 710 | Role.find_by_name('Manager').remove_permission! :export_wiki_pages |
|
706 | 711 | get :export, :project_id => 'ecookbook' |
|
707 | 712 | |
|
708 | 713 | assert_response 403 |
|
709 | 714 | end |
|
710 | 715 | |
|
711 | 716 | def test_date_index |
|
712 | 717 | get :date_index, :project_id => 'ecookbook' |
|
713 | 718 | |
|
714 | 719 | assert_response :success |
|
715 | 720 | assert_template 'date_index' |
|
716 | 721 | assert_not_nil assigns(:pages) |
|
717 | 722 | assert_not_nil assigns(:pages_by_date) |
|
718 | 723 | |
|
719 | 724 | assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} |
|
720 | 725 | end |
|
721 | 726 | |
|
722 | 727 | def test_not_found |
|
723 | 728 | get :show, :project_id => 999 |
|
724 | 729 | assert_response 404 |
|
725 | 730 | end |
|
726 | 731 | |
|
727 | 732 | def test_protect_page |
|
728 | 733 | page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page') |
|
729 | 734 | assert !page.protected? |
|
730 | 735 | @request.session[:user_id] = 2 |
|
731 | 736 | post :protect, :project_id => 1, :id => page.title, :protected => '1' |
|
732 | 737 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page' |
|
733 | 738 | assert page.reload.protected? |
|
734 | 739 | end |
|
735 | 740 | |
|
736 | 741 | def test_unprotect_page |
|
737 | 742 | page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation') |
|
738 | 743 | assert page.protected? |
|
739 | 744 | @request.session[:user_id] = 2 |
|
740 | 745 | post :protect, :project_id => 1, :id => page.title, :protected => '0' |
|
741 | 746 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'CookBook_documentation' |
|
742 | 747 | assert !page.reload.protected? |
|
743 | 748 | end |
|
744 | 749 | |
|
745 | 750 | def test_show_page_with_edit_link |
|
746 | 751 | @request.session[:user_id] = 2 |
|
747 | 752 | get :show, :project_id => 1 |
|
748 | 753 | assert_response :success |
|
749 | 754 | assert_template 'show' |
|
750 | 755 | assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } |
|
751 | 756 | end |
|
752 | 757 | |
|
753 | 758 | def test_show_page_without_edit_link |
|
754 | 759 | @request.session[:user_id] = 4 |
|
755 | 760 | get :show, :project_id => 1 |
|
756 | 761 | assert_response :success |
|
757 | 762 | assert_template 'show' |
|
758 | 763 | assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } |
|
759 | 764 | end |
|
760 | 765 | |
|
761 | 766 | def test_show_pdf |
|
762 | 767 | @request.session[:user_id] = 2 |
|
763 | 768 | get :show, :project_id => 1, :format => 'pdf' |
|
764 | 769 | assert_response :success |
|
765 | 770 | assert_not_nil assigns(:page) |
|
766 | 771 | assert_equal 'application/pdf', @response.content_type |
|
767 | 772 | assert_equal 'attachment; filename="CookBook_documentation.pdf"', |
|
768 | 773 | @response.headers['Content-Disposition'] |
|
769 | 774 | end |
|
770 | 775 | |
|
771 | 776 | def test_show_html |
|
772 | 777 | @request.session[:user_id] = 2 |
|
773 | 778 | get :show, :project_id => 1, :format => 'html' |
|
774 | 779 | assert_response :success |
|
775 | 780 | assert_not_nil assigns(:page) |
|
776 | 781 | assert_equal 'text/html', @response.content_type |
|
777 | 782 | assert_equal 'attachment; filename="CookBook_documentation.html"', |
|
778 | 783 | @response.headers['Content-Disposition'] |
|
779 | 784 | assert_tag 'h1', :content => 'CookBook documentation' |
|
780 | 785 | end |
|
781 | 786 | |
|
782 | 787 | def test_show_versioned_html |
|
783 | 788 | @request.session[:user_id] = 2 |
|
784 | 789 | get :show, :project_id => 1, :format => 'html', :version => 2 |
|
785 | 790 | assert_response :success |
|
786 | 791 | assert_not_nil assigns(:content) |
|
787 | 792 | assert_equal 2, assigns(:content).version |
|
788 | 793 | assert_equal 'text/html', @response.content_type |
|
789 | 794 | assert_equal 'attachment; filename="CookBook_documentation.html"', |
|
790 | 795 | @response.headers['Content-Disposition'] |
|
791 | 796 | assert_tag 'h1', :content => 'CookBook documentation' |
|
792 | 797 | end |
|
793 | 798 | |
|
794 | 799 | def test_show_txt |
|
795 | 800 | @request.session[:user_id] = 2 |
|
796 | 801 | get :show, :project_id => 1, :format => 'txt' |
|
797 | 802 | assert_response :success |
|
798 | 803 | assert_not_nil assigns(:page) |
|
799 | 804 | assert_equal 'text/plain', @response.content_type |
|
800 | 805 | assert_equal 'attachment; filename="CookBook_documentation.txt"', |
|
801 | 806 | @response.headers['Content-Disposition'] |
|
802 | 807 | assert_include 'h1. CookBook documentation', @response.body |
|
803 | 808 | end |
|
804 | 809 | |
|
805 | 810 | def test_show_versioned_txt |
|
806 | 811 | @request.session[:user_id] = 2 |
|
807 | 812 | get :show, :project_id => 1, :format => 'txt', :version => 2 |
|
808 | 813 | assert_response :success |
|
809 | 814 | assert_not_nil assigns(:content) |
|
810 | 815 | assert_equal 2, assigns(:content).version |
|
811 | 816 | assert_equal 'text/plain', @response.content_type |
|
812 | 817 | assert_equal 'attachment; filename="CookBook_documentation.txt"', |
|
813 | 818 | @response.headers['Content-Disposition'] |
|
814 | 819 | assert_include 'h1. CookBook documentation', @response.body |
|
815 | 820 | end |
|
816 | 821 | |
|
817 | 822 | def test_edit_unprotected_page |
|
818 | 823 | # Non members can edit unprotected wiki pages |
|
819 | 824 | @request.session[:user_id] = 4 |
|
820 | 825 | get :edit, :project_id => 1, :id => 'Another_page' |
|
821 | 826 | assert_response :success |
|
822 | 827 | assert_template 'edit' |
|
823 | 828 | end |
|
824 | 829 | |
|
825 | 830 | def test_edit_protected_page_by_nonmember |
|
826 | 831 | # Non members can't edit protected wiki pages |
|
827 | 832 | @request.session[:user_id] = 4 |
|
828 | 833 | get :edit, :project_id => 1, :id => 'CookBook_documentation' |
|
829 | 834 | assert_response 403 |
|
830 | 835 | end |
|
831 | 836 | |
|
832 | 837 | def test_edit_protected_page_by_member |
|
833 | 838 | @request.session[:user_id] = 2 |
|
834 | 839 | get :edit, :project_id => 1, :id => 'CookBook_documentation' |
|
835 | 840 | assert_response :success |
|
836 | 841 | assert_template 'edit' |
|
837 | 842 | end |
|
838 | 843 | |
|
839 | 844 | def test_history_of_non_existing_page_should_return_404 |
|
840 | 845 | get :history, :project_id => 1, :id => 'Unknown_page' |
|
841 | 846 | assert_response 404 |
|
842 | 847 | end |
|
843 | 848 | |
|
844 | 849 | def test_add_attachment |
|
845 | 850 | @request.session[:user_id] = 2 |
|
846 | 851 | assert_difference 'Attachment.count' do |
|
847 | 852 | post :add_attachment, :project_id => 1, :id => 'CookBook_documentation', |
|
848 | 853 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}} |
|
849 | 854 | end |
|
850 | 855 | attachment = Attachment.first(:order => 'id DESC') |
|
851 | 856 | assert_equal Wiki.find(1).find_page('CookBook_documentation'), attachment.container |
|
852 | 857 | end |
|
853 | 858 | end |
General Comments 0
You need to be logged in to leave comments.
Login now