Mercurial > kallithea
changeset 7310:d64cf8f33f6f stable
tests: improve test coverage of clone_uri and expose some existing problems with unauthenticated cloning from local repos
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 07 May 2018 11:37:55 +0200 |
parents | f359ebe73041 |
children | 02e0d2d469bf |
files | kallithea/tests/api/api_base.py |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/api/api_base.py Mon May 07 00:49:44 2018 +0200 +++ b/kallithea/tests/api/api_base.py Mon May 07 11:37:55 2018 +0200 @@ -994,6 +994,25 @@ self._compare_ok(id_, expected, given=response.body) fixture.destroy_repo(repo_name) + def test_api_create_repo_clone_uri_local(self): + # FIXME: cloning from local repo is a mis-feature - it will bypass access control + clone_uri = os.path.join(TESTS_TMP_PATH, self.REPO) + repo_name = u'api-repo' + id_, params = _build_data(self.apikey, 'create_repo', + repo_name=repo_name, + owner=TEST_USER_ADMIN_LOGIN, + repo_type=self.REPO_TYPE, + clone_uri=clone_uri, + ) + response = api_call(self, params) + expected = { + 'msg': 'Created new repository `%s`' % repo_name, + 'success': True, + 'task': None, + } + self._compare_ok(id_, expected, given=response.body) + fixture.destroy_repo(repo_name) + def test_api_create_repo_and_repo_group(self): repo_name = 'my_gr/api-repo' id_, params = _build_data(self.apikey, 'create_repo', @@ -1139,6 +1158,7 @@ ('active', {'active': True}), ('active', {'active': False}), ('clone_uri', {'clone_uri': 'http://example.com/repo'}), + ('clone_uri', {'clone_uri': '/repo'}), # FIXME: pulling from local repo is a mis-feature - it will bypass access control ('clone_uri', {'clone_uri': None}), ('landing_rev', {'landing_rev': 'branch:master'}), ('enable_statistics', {'enable_statistics': True}), @@ -1177,6 +1197,7 @@ ('active', {'active': True}), ('active', {'active': False}), ('clone_uri', {'clone_uri': 'http://example.com/repo'}), + ('clone_uri', {'clone_uri': '/repo'}), # FIXME: pulling from local repo is a mis-feature - it will bypass access control ('clone_uri', {'clone_uri': None}), ('landing_rev', {'landing_rev': 'branch:master'}), ('enable_statistics', {'enable_statistics': True}),