comparison rhodecode/tests/api/api_base.py @ 3457:08e8115585bd beta

calling lock function without lock attribute, will return lock state
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 05 Mar 2013 20:03:33 +0100
parents fa6ba6727475
children 7cde75eac0fe
comparison
equal deleted inserted replaced
3456:cf1fbc9fed89 3457:08e8115585bd
366 repoid=self.REPO, 366 repoid=self.REPO,
367 locked=True) 367 locked=True)
368 response = api_call(self, params) 368 response = api_call(self, params)
369 expected = ('User `%s` set lock state for repo `%s` to `%s`' 369 expected = ('User `%s` set lock state for repo `%s` to `%s`'
370 % (TEST_USER_ADMIN_LOGIN, self.REPO, True)) 370 % (TEST_USER_ADMIN_LOGIN, self.REPO, True))
371 self._compare_ok(id_, expected, given=response.body)
372
373 def test_api_lock_repo_lock_optional_locked(self):
374 from rhodecode.lib import helpers
375 from rhodecode.lib.utils2 import time_to_datetime
376 _locked_since = helpers.fmt_date(time_to_datetime(Repository\
377 .get_by_repo_name(self.REPO).locked[1]))
378 id_, params = _build_data(self.apikey, 'lock',
379 repoid=self.REPO)
380 response = api_call(self, params)
381 expected = ('Repo `%s` locked by `%s`. Locked=`True`. Locked since: `%s`'
382 % (self.REPO, TEST_USER_ADMIN_LOGIN, _locked_since))
371 self._compare_ok(id_, expected, given=response.body) 383 self._compare_ok(id_, expected, given=response.body)
372 384
373 @mock.patch.object(Repository, 'lock', crash) 385 @mock.patch.object(Repository, 'lock', crash)
374 def test_api_lock_error(self): 386 def test_api_lock_error(self):
375 id_, params = _build_data(self.apikey, 'lock', 387 id_, params = _build_data(self.apikey, 'lock',