changeset 7744:b5fe8bc0b939

tests: introduce test_vcs_operations test_pull with explicit testing of pull operations and their logging
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 07 Jun 2019 03:37:14 +0200
parents 310f557d06ca
children 624971c4d246
files kallithea/tests/other/test_vcs_operations.py
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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])]