Show More
@@ -0,0 +1,40 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | # Copyright (C) 2010-2016 RhodeCode GmbH | |
|
4 | # | |
|
5 | # This program is free software: you can redistribute it and/or modify | |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
|
7 | # (only), as published by the Free Software Foundation. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
|
16 | # | |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
|
20 | ||
|
21 | ||
|
22 | import pytest | |
|
23 | ||
|
24 | from rhodecode.model.meta import Session | |
|
25 | from rhodecode.model.repo import RepoModel | |
|
26 | from rhodecode.model.user import UserModel | |
|
27 | from rhodecode.tests import TEST_USER_ADMIN_LOGIN | |
|
28 | from rhodecode.api.tests.utils import ( | |
|
29 | build_data, api_call, assert_ok, assert_error, expected_permissions) | |
|
30 | ||
|
31 | ||
|
32 | @pytest.mark.usefixtures("testuser_api", "app") | |
|
33 | class TestGetRepo(object): | |
|
34 | def test_api_get_repo_refs(self, backend, user_util): | |
|
35 | repo = backend.create_repo() | |
|
36 | id_, params = build_data(self.apikey, 'get_repo_refs', | |
|
37 | **{'repoid': repo.repo_name,}) | |
|
38 | response = api_call(self.app, params) | |
|
39 | expected = repo.scm_instance().refs() | |
|
40 | assert_ok(id_, expected, given=response.body) |
@@ -512,9 +512,23 b' def get_repo_refs(request, apiuser, repo' | |||
|
512 | 512 | .. code-block:: bash |
|
513 | 513 | |
|
514 | 514 | id : <id_given_in_input> |
|
515 |
result |
|
|
516 | TODO... | |
|
517 | ] | |
|
515 | "result": { | |
|
516 | "bookmarks": { | |
|
517 | "dev": "5611d30200f4040ba2ab4f3d64e5b06408a02188", | |
|
518 | "master": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf" | |
|
519 | }, | |
|
520 | "branches": { | |
|
521 | "default": "5611d30200f4040ba2ab4f3d64e5b06408a02188", | |
|
522 | "stable": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf" | |
|
523 | }, | |
|
524 | "branches_closed": {}, | |
|
525 | "tags": { | |
|
526 | "tip": "5611d30200f4040ba2ab4f3d64e5b06408a02188", | |
|
527 | "v4.4.0": "1232313f9e6adac5ce5399c2a891dc1e72b79022", | |
|
528 | "v4.4.1": "cbb9f1d329ae5768379cdec55a62ebdd546c4e27", | |
|
529 | "v4.4.2": "24ffe44a27fcd1c5b6936144e176b9f6dd2f3a17", | |
|
530 | } | |
|
531 | } | |
|
518 | 532 | error: null |
|
519 | 533 | """ |
|
520 | 534 |
@@ -226,7 +226,12 b' class BaseRepository(object):' | |||
|
226 | 226 | returns a `dict` with branches, bookmarks, tags, and closed_branches |
|
227 | 227 | for this repository |
|
228 | 228 | """ |
|
229 | raise NotImplementedError | |
|
229 | return dict( | |
|
230 | branches=self.branches, | |
|
231 | branches_closed=self.branches_closed, | |
|
232 | tags=self.tags, | |
|
233 | bookmarks=self.bookmarks | |
|
234 | ) | |
|
230 | 235 | |
|
231 | 236 | @LazyProperty |
|
232 | 237 | def branches(self): |
@@ -236,6 +241,13 b' class BaseRepository(object):' | |||
|
236 | 241 | raise NotImplementedError |
|
237 | 242 | |
|
238 | 243 | @LazyProperty |
|
244 | def tags(self): | |
|
245 | """ | |
|
246 | A `dict` which maps tags names to commit ids. | |
|
247 | """ | |
|
248 | raise NotImplementedError | |
|
249 | ||
|
250 | @LazyProperty | |
|
239 | 251 | def size(self): |
|
240 | 252 | """ |
|
241 | 253 | Returns combined size in bytes for all repository files |
General Comments 0
You need to be logged in to leave comments.
Login now