comparison rhodecode/tests/api/api_base.py @ 3235:d6029dacbcc4 beta

API invalidate_cache function ref #733
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 26 Jan 2013 23:12:50 +0100
parents 81bbb8086f03
children b8f929bff7e3
comparison
equal deleted inserted replaced
3234:21cccfea18bf 3235:d6029dacbcc4
282 def test_api_rescann_error(self): 282 def test_api_rescann_error(self):
283 id_, params = _build_data(self.apikey, 'rescan_repos',) 283 id_, params = _build_data(self.apikey, 'rescan_repos',)
284 response = api_call(self, params) 284 response = api_call(self, params)
285 285
286 expected = 'Error occurred during rescan repositories action' 286 expected = 'Error occurred during rescan repositories action'
287 self._compare_error(id_, expected, given=response.body)
288
289 def test_api_invalidate_cache(self):
290 id_, params = _build_data(self.apikey, 'invalidate_cache',
291 repoid=self.REPO)
292 response = api_call(self, params)
293
294 expected = ("Cache for repository `%s` was invalidated: "
295 "invalidated cache keys: %s" % (self.REPO,
296 [unicode(self.REPO)]))
297 self._compare_ok(id_, expected, given=response.body)
298
299 @mock.patch.object(ScmModel, 'mark_for_invalidation', crash)
300 def test_api_invalidate_cache_error(self):
301 id_, params = _build_data(self.apikey, 'invalidate_cache',
302 repoid=self.REPO)
303 response = api_call(self, params)
304
305 expected = 'Error occurred during cache invalidation action'
287 self._compare_error(id_, expected, given=response.body) 306 self._compare_error(id_, expected, given=response.body)
288 307
289 def test_api_lock_repo_lock_aquire(self): 308 def test_api_lock_repo_lock_aquire(self):
290 id_, params = _build_data(self.apikey, 'lock', 309 id_, params = _build_data(self.apikey, 'lock',
291 userid=TEST_USER_ADMIN_LOGIN, 310 userid=TEST_USER_ADMIN_LOGIN,