Mercurial > kallithea
changeset 7139:91603c55aa61
tests: api: cover original behavior for 'pull'
Up to commit 85d812ab4c64, the api 'pull' method can either pull from the
repository's specified remote (clone_uri) or, if the repository is a fork,
from the fork origin.
The existing test case only covered pulling from a remote, and pulling from
a repo (non-fork) that does not have a remote specified.
Update the test method naming to clarify this, and add a test to pull from a
fork.
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Sun, 11 Feb 2018 13:54:19 +0100 |
parents | 4086efa27652 |
children | 3020943319f7 |
files | kallithea/tests/api/api_base.py |
diffstat | 1 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/api/api_base.py Wed Feb 07 09:24:14 2018 +0100 +++ b/kallithea/tests/api/api_base.py Sun Feb 11 13:54:19 2018 +0100 @@ -276,7 +276,7 @@ expected = 'userid is not the same as your user' self._compare_error(id_, expected, given=response.body) - def test_api_pull(self): + def test_api_pull_remote(self): repo_name = u'test_pull' r = fixture.create_repo(repo_name, repo_type=self.REPO_TYPE) r.clone_uri = os.path.join(Ui.get_by_key('paths', '/').ui_value, self.REPO) @@ -292,7 +292,21 @@ fixture.destroy_repo(repo_name) - def test_api_pull_error(self): + def test_api_pull_fork(self): + fork_name = u'fork' + fixture.create_fork(self.REPO, fork_name) + id_, params = _build_data(self.apikey, 'pull', + repoid=fork_name,) + response = api_call(self, params) + + expected = {'msg': 'Pulled from `%s`' % fork_name, + 'repository': fork_name} + self._compare_ok(id_, expected, given=response.body) + + fixture.destroy_repo(fork_name) + + def test_api_pull_error_no_remote_no_fork(self): + # should fail because no clone_uri is set id_, params = _build_data(self.apikey, 'pull', repoid=self.REPO, ) response = api_call(self, params)