# HG changeset patch # User Mads Kiilerich # Date 1559871434 -7200 # Node ID b5fe8bc0b939b6f5b97595ba09858ab718889ef9 # Parent 310f557d06ca3a2e624f87edaf1c11733f8f3626 tests: introduce test_vcs_operations test_pull with explicit testing of pull operations and their logging diff -r 310f557d06ca -r b5fe8bc0b939 kallithea/tests/other/test_vcs_operations.py --- a/kallithea/tests/other/test_vcs_operations.py Thu Jan 17 03:56:34 2019 +0100 +++ b/kallithea/tests/other/test_vcs_operations.py Fri Jun 07 03:37:14 2019 +0200 @@ -348,6 +348,26 @@ [(u'pull', 0), (u'push', 3)] @parametrize_vcs_test + def test_pull(self, webserver, testfork, vt): + UserLog.query().delete() + Session().commit() + + dest_dir = _get_tmp_dir() + stdout, stderr = Command(TESTS_TMP_PATH).execute(vt.repo_type, 'init', dest_dir) + + clone_url = vt.repo_url_param(webserver, vt.repo_name) + print (vt, clone_url) + stdout, stderr = Command(dest_dir).execute(vt.repo_type, 'pull', clone_url) + + if vt.repo_type == 'git': + assert 'FETCH_HEAD' in stderr + elif vt.repo_type == 'hg': + assert 'new changesets' in stdout + + action_parts = [ul.action for ul in UserLog.query().order_by(UserLog.user_log_id)] + assert action_parts == [u'pull'] + + @parametrize_vcs_test def test_push_invalidates_cache(self, webserver, testfork, vt): pre_cached_tip = [repo.get_api_data()['last_changeset']['short_id'] for repo in Repository.query().filter(Repository.repo_name == testfork[vt.repo_type])]