comparison rhodecode/tests/functional/test_files.py @ 1063:bbddef1e9ef2 beta

fixes and extends file tests
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 19 Feb 2011 00:49:08 +0100
parents 15b60f83420c
children 113a8db22852
comparison
equal deleted inserted replaced
1062:053983a464e4 1063:bbddef1e9ef2
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 assert False 249 #print response.body()
250 #assert False
250 #TODO: put in more 251 #TODO: put in more
252
251 def test_raw_file_wrong_cs(self): 253 def test_raw_file_wrong_cs(self):
252 self.log_user() 254 self.log_user()
253 rev = u'ERRORcce30c96924232dffcd24178a07ffeb5dfc' 255 rev = u'ERRORce30c96924232dffcd24178a07ffeb5dfc'
254 f_path = 'vcs/nodes.py' 256 f_path = 'vcs/nodes.py'
255 257
256 response = self.app.get(url(controller='files', action='rawfile', 258 response = self.app.get(url(controller='files', action='rawfile',
257 repo_name=HG_REPO, 259 repo_name=HG_REPO,
258 revision='ERRORce30c96924232dffcd24178a07ffeb5dfc', 260 revision=rev,
259 f_path='vcs/nodes.py')) 261 f_path='vcs/nodes.py'))
260 print response.session['flash'] 262
261 assert """Revision %r does not exist for this repository""" % (rev) in response.session['flash'][0], 'No flash message' 263 assert """Revision %r does not exist for this repository""" % (rev) in response.session['flash'][0][1], 'No flash message'
262 assert """%s""" % (HG_REPO) in response.session['flash'][0], 'No flash message' 264 assert """%s""" % (HG_REPO) in response.session['flash'][0][1], 'No flash message'
263 265
264 266
265 267
266 def test_raw_file_wrong_f_path(self): 268 def test_raw_file_wrong_f_path(self):
267 self.log_user() 269 self.log_user()
269 f_path = 'vcs/ERRORnodes.py' 271 f_path = 'vcs/ERRORnodes.py'
270 response = self.app.get(url(controller='files', action='rawfile', 272 response = self.app.get(url(controller='files', action='rawfile',
271 repo_name=HG_REPO, 273 repo_name=HG_REPO,
272 revision=rev, 274 revision=rev,
273 f_path=f_path)) 275 f_path=f_path))
274 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' 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'
275 277
276 #========================================================================== 278 #==========================================================================
277 # RAW 279 # RAW
278 #========================================================================== 280 #==========================================================================
279 def test_raw_ok(self): 281 def test_raw_ok(self):
280 self.log_user() 282 self.log_user()
281 response = self.app.get(url(controller='files', action='raw', 283 response = self.app.get(url(controller='files', action='raw',
282 repo_name=HG_REPO, 284 repo_name=HG_REPO,
283 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc', 285 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
284 f_path='vcs/nodes.py')) 286 f_path='vcs/nodes.py'))
285 assert False 287 #assert False
286 #TODO: put in more 288 #TODO: put in more
289
287 def test_raw_wrong_cs(self): 290 def test_raw_wrong_cs(self):
288 self.log_user() 291 self.log_user()
289 rev = 'ERRORcce30c96924232dffcd24178a07ffeb5dfc' 292 rev = u'ERRORcce30c96924232dffcd24178a07ffeb5dfc'
290 f_path = 'vcs/nodes.py' 293 f_path = 'vcs/nodes.py'
291 294
292 response = self.app.get(url(controller='files', action='raw', 295 response = self.app.get(url(controller='files', action='raw',
293 repo_name=HG_REPO, 296 repo_name=HG_REPO,
294 revision='ERRORce30c96924232dffcd24178a07ffeb5dfc', 297 revision=rev,
295 f_path='vcs/nodes.py')) 298 f_path='vcs/nodes.py'))
296 assert "Cannot find revision %s" % rev in response.session['flash'][0], 'No flash message' 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'
302 assert """%s""" % (HG_REPO) in response.session['flash'][0][1], 'No flash message'
303
297 304
298 def test_raw_wrong_f_path(self): 305 def test_raw_wrong_f_path(self):
299 self.log_user() 306 self.log_user()
300 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' 307 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
301 f_path = 'vcs/ERRORnodes.py' 308 f_path = 'vcs/ERRORnodes.py'
302 response = self.app.get(url(controller='files', action='raw', 309 response = self.app.get(url(controller='files', action='raw',
303 repo_name=HG_REPO, 310 repo_name=HG_REPO,
304 revision=rev, 311 revision=rev,
305 f_path=f_path)) 312 f_path=f_path))
306 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' 313
307 314 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'
315