Mercurial > kallithea
comparison rhodecode/tests/functional/test_files.py @ 1064:113a8db22852 beta
file tests updates + extended the feed tests
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 19 Feb 2011 01:05:20 +0100 |
parents | bbddef1e9ef2 |
children | 6832ef664673 |
comparison
equal
deleted
inserted
replaced
1063:bbddef1e9ef2 | 1064:113a8db22852 |
---|---|
244 self.log_user() | 244 self.log_user() |
245 response = self.app.get(url(controller='files', action='rawfile', | 245 response = self.app.get(url(controller='files', action='rawfile', |
246 repo_name=HG_REPO, | 246 repo_name=HG_REPO, |
247 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', | 247 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', |
248 f_path='vcs/nodes.py')) | 248 f_path='vcs/nodes.py')) |
249 #print response.body() | 249 |
250 #assert False | 250 assert response.content_disposition == "attachment; filename=nodes.py" |
251 #TODO: put in more | 251 assert response.content_type == "text/x-python" |
252 | 252 |
253 def test_raw_file_wrong_cs(self): | 253 def test_raw_file_wrong_cs(self): |
254 self.log_user() | 254 self.log_user() |
255 rev = u'ERRORce30c96924232dffcd24178a07ffeb5dfc' | 255 rev = u'ERRORce30c96924232dffcd24178a07ffeb5dfc' |
256 f_path = 'vcs/nodes.py' | 256 f_path = 'vcs/nodes.py' |
257 | 257 |
258 response = self.app.get(url(controller='files', action='rawfile', | 258 response = self.app.get(url(controller='files', action='rawfile', |
259 repo_name=HG_REPO, | 259 repo_name=HG_REPO, |
260 revision=rev, | 260 revision=rev, |
261 f_path='vcs/nodes.py')) | 261 f_path=f_path)) |
262 | 262 |
263 assert """Revision %r does not exist for this repository""" % (rev) in response.session['flash'][0][1], 'No flash message' | 263 assert """Revision %r does not exist for this repository""" % (rev) in response.session['flash'][0][1], 'No flash message' |
264 assert """%s""" % (HG_REPO) in response.session['flash'][0][1], 'No flash message' | 264 assert """%s""" % (HG_REPO) in response.session['flash'][0][1], 'No flash message' |
265 | 265 |
266 | 266 |
274 revision=rev, | 274 revision=rev, |
275 f_path=f_path)) | 275 f_path=f_path)) |
276 assert "There is no file nor directory at the given path: %r at revision %r" % (f_path, rev[:12]) in response.session['flash'][0][1], 'No flash message' | 276 assert "There is no file nor directory at the given path: %r at revision %r" % (f_path, rev[:12]) in response.session['flash'][0][1], 'No flash message' |
277 | 277 |
278 #========================================================================== | 278 #========================================================================== |
279 # RAW | 279 # RAW RESPONSE - PLAIN |
280 #========================================================================== | 280 #========================================================================== |
281 def test_raw_ok(self): | 281 def test_raw_ok(self): |
282 self.log_user() | 282 self.log_user() |
283 response = self.app.get(url(controller='files', action='raw', | 283 response = self.app.get(url(controller='files', action='raw', |
284 repo_name=HG_REPO, | 284 repo_name=HG_REPO, |
285 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', | 285 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', |
286 f_path='vcs/nodes.py')) | 286 f_path='vcs/nodes.py')) |
287 #assert False | 287 |
288 #TODO: put in more | 288 assert response.content_type == "text/plain" |
289 | 289 |
290 def test_raw_wrong_cs(self): | 290 def test_raw_wrong_cs(self): |
291 self.log_user() | 291 self.log_user() |
292 rev = u'ERRORcce30c96924232dffcd24178a07ffeb5dfc' | 292 rev = u'ERRORcce30c96924232dffcd24178a07ffeb5dfc' |
293 f_path = 'vcs/nodes.py' | 293 f_path = 'vcs/nodes.py' |
294 | 294 |
295 response = self.app.get(url(controller='files', action='raw', | 295 response = self.app.get(url(controller='files', action='raw', |
296 repo_name=HG_REPO, | 296 repo_name=HG_REPO, |
297 revision=rev, | 297 revision=rev, |
298 f_path='vcs/nodes.py')) | 298 f_path=f_path)) |
299 | 299 |
300 print response.session['flash'][0][1] | |
301 assert """Revision %r does not exist for this repository""" % (rev) in response.session['flash'][0][1], 'No flash message' | 300 assert """Revision %r does not exist for this repository""" % (rev) in response.session['flash'][0][1], 'No flash message' |
302 assert """%s""" % (HG_REPO) in response.session['flash'][0][1], 'No flash message' | 301 assert """%s""" % (HG_REPO) in response.session['flash'][0][1], 'No flash message' |
303 | 302 |
304 | 303 |
305 def test_raw_wrong_f_path(self): | 304 def test_raw_wrong_f_path(self): |