Mercurial > kallithea
changeset 7292:8e51bf654165
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 | cf6758771b9c |
children | 9ff917d87291 |
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 @@ -1041,6 +1041,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 = u'my_gr/api-repo' id_, params = _build_data(self.apikey, 'create_repo', @@ -1184,6 +1203,7 @@ ('owner', {'owner': TEST_USER_REGULAR_LOGIN}), ('description', {'description': u'new description'}), ('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}), @@ -1220,6 +1240,7 @@ ('owner', {'owner': TEST_USER_REGULAR_LOGIN}), ('description', {'description': u'new description'}), ('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}),