Mercurial > kallithea
comparison rhodecode/tests/functional/test_files.py @ 3621:fe012b7df29d beta
missing files or bad files revisions should return 404s not redirects - ref #808
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 27 Mar 2013 21:05:59 +0100 |
parents | ca7785fae354 |
children | ec6354949623 |
comparison
equal
deleted
inserted
replaced
3620:a2afaf84330c | 3621:fe012b7df29d |
---|---|
287 f_path = 'vcs/nodes.py' | 287 f_path = 'vcs/nodes.py' |
288 | 288 |
289 response = self.app.get(url(controller='files', action='rawfile', | 289 response = self.app.get(url(controller='files', action='rawfile', |
290 repo_name=HG_REPO, | 290 repo_name=HG_REPO, |
291 revision=rev, | 291 revision=rev, |
292 f_path=f_path)) | 292 f_path=f_path), status=404) |
293 | 293 |
294 msg = """Revision %s does not exist for this repository""" % (rev) | 294 msg = """Revision %s does not exist for this repository""" % (rev) |
295 self.checkSessionFlash(response, msg) | 295 response.mustcontain(msg) |
296 | |
297 self.assertEqual('http://localhost/%s/files/tip/' % HG_REPO, response.headers['location']) | |
298 | 296 |
299 def test_raw_file_wrong_f_path(self): | 297 def test_raw_file_wrong_f_path(self): |
300 self.log_user() | 298 self.log_user() |
301 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' | 299 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' |
302 f_path = 'vcs/ERRORnodes.py' | 300 f_path = 'vcs/ERRORnodes.py' |
303 response = self.app.get(url(controller='files', action='rawfile', | 301 response = self.app.get(url(controller='files', action='rawfile', |
304 repo_name=HG_REPO, | 302 repo_name=HG_REPO, |
305 revision=rev, | 303 revision=rev, |
306 f_path=f_path)) | 304 f_path=f_path), status=404) |
307 | 305 |
308 msg = "There is no file nor directory at the given path: '%s' at revision %s" % (f_path, rev[:12]) | 306 msg = "There is no file nor directory at the given path: '%s' at revision %s" % (f_path, rev[:12]) |
309 self.checkSessionFlash(response, msg) | 307 response.mustcontain(msg) |
310 | 308 |
311 #========================================================================== | 309 #========================================================================== |
312 # RAW RESPONSE - PLAIN | 310 # RAW RESPONSE - PLAIN |
313 #========================================================================== | 311 #========================================================================== |
314 def test_raw_ok(self): | 312 def test_raw_ok(self): |
326 f_path = 'vcs/nodes.py' | 324 f_path = 'vcs/nodes.py' |
327 | 325 |
328 response = self.app.get(url(controller='files', action='raw', | 326 response = self.app.get(url(controller='files', action='raw', |
329 repo_name=HG_REPO, | 327 repo_name=HG_REPO, |
330 revision=rev, | 328 revision=rev, |
331 f_path=f_path)) | 329 f_path=f_path), status=404) |
330 | |
332 msg = """Revision %s does not exist for this repository""" % (rev) | 331 msg = """Revision %s does not exist for this repository""" % (rev) |
333 self.checkSessionFlash(response, msg) | 332 response.mustcontain(msg) |
334 | |
335 self.assertEqual('http://localhost/%s/files/tip/' % HG_REPO, response.headers['location']) | |
336 | 333 |
337 def test_raw_wrong_f_path(self): | 334 def test_raw_wrong_f_path(self): |
338 self.log_user() | 335 self.log_user() |
339 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' | 336 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' |
340 f_path = 'vcs/ERRORnodes.py' | 337 f_path = 'vcs/ERRORnodes.py' |
341 response = self.app.get(url(controller='files', action='raw', | 338 response = self.app.get(url(controller='files', action='raw', |
342 repo_name=HG_REPO, | 339 repo_name=HG_REPO, |
343 revision=rev, | 340 revision=rev, |
344 f_path=f_path)) | 341 f_path=f_path), status=404) |
345 msg = "There is no file nor directory at the given path: '%s' at revision %s" % (f_path, rev[:12]) | 342 msg = "There is no file nor directory at the given path: '%s' at revision %s" % (f_path, rev[:12]) |
346 self.checkSessionFlash(response, msg) | 343 response.mustcontain(msg) |
347 | 344 |
348 def test_ajaxed_files_list(self): | 345 def test_ajaxed_files_list(self): |
349 self.log_user() | 346 self.log_user() |
350 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' | 347 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' |
351 response = self.app.get( | 348 response = self.app.get( |
352 url('files_nodelist_home', repo_name=HG_REPO,f_path='/',revision=rev), | 349 url('files_nodelist_home', repo_name=HG_REPO, f_path='/', |
350 revision=rev), | |
353 extra_environ={'HTTP_X_PARTIAL_XHR': '1'}, | 351 extra_environ={'HTTP_X_PARTIAL_XHR': '1'}, |
354 ) | 352 ) |
355 response.mustcontain("vcs/web/simplevcs/views/repository.py") | 353 response.mustcontain("vcs/web/simplevcs/views/repository.py") |
354 | |
355 def test_add_file_view_hg(self): | |
356 self.log_user() | |
357 response = self.app.get(url('files_add_home', | |
358 repo_name=HG_REPO, | |
359 revision='tip', f_path='/')) | |
360 | |
361 def test_add_file_view_git(self): | |
362 self.log_user() | |
363 response = self.app.get(url('files_add_home', | |
364 repo_name=GIT_REPO, | |
365 revision='tip', f_path='/')) | |
366 | |
367 def test_edit_file_view_hg(self): | |
368 self.log_user() | |
369 response = self.app.get(url('files_edit_home', | |
370 repo_name=HG_REPO, | |
371 revision='tip', f_path='vcs/nodes.py')) | |
372 | |
373 def test_edit_file_view_git(self): | |
374 self.log_user() | |
375 response = self.app.get(url('files_edit_home', | |
376 repo_name=GIT_REPO, | |
377 revision='tip', f_path='vcs/nodes.py')) |