aboutsummaryrefslogtreecommitdiff
path: root/rhodecode/tests
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2013-03-07 20:06:45 +0100
committerMarcin Kuzminski <marcin@python-works.com>2013-03-07 20:06:45 +0100
commit42c7db9b2a754b2c5aaaed7682550c4cb3de7c70 (patch)
tree4f1f3462efb4654ca7e058ce6a9f331c3edbe0d0 /rhodecode/tests
parent2e9e49458247fdc9fd35a6508961a6ae682f3f7a (diff)
get_locks API function draft
--HG-- branch : beta
Diffstat (limited to 'rhodecode/tests')
-rw-r--r--rhodecode/tests/api/api_base.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/rhodecode/tests/api/api_base.py b/rhodecode/tests/api/api_base.py
index 5ca86e70..340808ac 100644
--- a/rhodecode/tests/api/api_base.py
+++ b/rhodecode/tests/api/api_base.py
@@ -371,9 +371,8 @@ class BaseTestApi(object):
self._compare_ok(id_, expected, given=response.body)
def test_api_lock_repo_lock_optional_locked(self):
- from rhodecode.lib import helpers
from rhodecode.lib.utils2 import time_to_datetime
- _locked_since = helpers.fmt_date(time_to_datetime(Repository\
+ _locked_since = json.dumps(time_to_datetime(Repository\
.get_by_repo_name(self.REPO).locked[1]))
id_, params = _build_data(self.apikey, 'lock',
repoid=self.REPO)
@@ -393,6 +392,32 @@ class BaseTestApi(object):
expected = 'Error occurred locking repository `%s`' % self.REPO
self._compare_error(id_, expected, given=response.body)
+ def test_api_get_locks_regular_user(self):
+ id_, params = _build_data(self.apikey_regular, 'get_locks')
+ response = api_call(self, params)
+ expected = []
+ self._compare_ok(id_, expected, given=response.body)
+
+ def test_api_get_locks_with_userid_regular_user(self):
+ id_, params = _build_data(self.apikey_regular, 'get_locks',
+ userid=TEST_USER_ADMIN_LOGIN)
+ response = api_call(self, params)
+ expected = 'userid is not the same as your user'
+ self._compare_error(id_, expected, given=response.body)
+
+ def test_api_get_locks(self):
+ id_, params = _build_data(self.apikey, 'get_locks')
+ response = api_call(self, params)
+ expected = []
+ self._compare_ok(id_, expected, given=response.body)
+
+ def test_api_get_locks_with_userid(self):
+ id_, params = _build_data(self.apikey, 'get_locks',
+ userid=TEST_USER_REGULAR_LOGIN)
+ response = api_call(self, params)
+ expected = []
+ self._compare_ok(id_, expected, given=response.body)
+
def test_api_create_existing_user(self):
id_, params = _build_data(self.apikey, 'create_user',
username=TEST_USER_ADMIN_LOGIN,