diff --git a/rhodecode/tests/functional/test_files.py b/rhodecode/tests/functional/test_files.py --- a/rhodecode/tests/functional/test_files.py +++ b/rhodecode/tests/functional/test_files.py @@ -237,5 +237,71 @@ removed extra unicode conversion in diff fname=fname)) assert 'Unknown revision' in response.body + #========================================================================== + # RAW FILE + #========================================================================== + def test_raw_file_ok(self): + self.log_user() + response = self.app.get(url(controller='files', action='rawfile', + repo_name=HG_REPO, + revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', + f_path='vcs/nodes.py')) + assert False + #TODO: put in more + def test_raw_file_wrong_cs(self): + self.log_user() + rev = u'ERRORcce30c96924232dffcd24178a07ffeb5dfc' + f_path = 'vcs/nodes.py' + + response = self.app.get(url(controller='files', action='rawfile', + repo_name=HG_REPO, + revision='ERRORce30c96924232dffcd24178a07ffeb5dfc', + f_path='vcs/nodes.py')) + print response.session['flash'] + assert """Revision %r does not exist for this repository""" % (rev) in response.session['flash'][0], 'No flash message' + assert """%s""" % (HG_REPO) in response.session['flash'][0], 'No flash message' + + def test_raw_file_wrong_f_path(self): + self.log_user() + rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' + f_path = 'vcs/ERRORnodes.py' + response = self.app.get(url(controller='files', action='rawfile', + repo_name=HG_REPO, + revision=rev, + f_path=f_path)) + assert "There is no file nor directory at the given path %r at revision %r" % (f_path, rev) in response.session['flash'][0], 'No flash message' + + #========================================================================== + # RAW + #========================================================================== + def test_raw_ok(self): + self.log_user() + response = self.app.get(url(controller='files', action='raw', + repo_name=HG_REPO, + revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', + f_path='vcs/nodes.py')) + assert False + #TODO: put in more + def test_raw_wrong_cs(self): + self.log_user() + rev = 'ERRORcce30c96924232dffcd24178a07ffeb5dfc' + f_path = 'vcs/nodes.py' + + response = self.app.get(url(controller='files', action='raw', + repo_name=HG_REPO, + revision='ERRORce30c96924232dffcd24178a07ffeb5dfc', + f_path='vcs/nodes.py')) + assert "Cannot find revision %s" % rev in response.session['flash'][0], 'No flash message' + + def test_raw_wrong_f_path(self): + self.log_user() + rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' + f_path = 'vcs/ERRORnodes.py' + response = self.app.get(url(controller='files', action='raw', + repo_name=HG_REPO, + revision=rev, + f_path=f_path)) + assert "There is no file nor directory at the given path %r at revision %r" % (f_path, rev) in response.session['flash'][0], 'No flash message' +