changeset 7683:b8551ceab448

tests: verify in vcs test_push_invalidates_cache that the push hook actually updates the cache
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 21 Jan 2019 03:39:26 +0100
parents f8c0549df529
children 65d45e2fbc33
files kallithea/tests/other/test_vcs_operations.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/other/test_vcs_operations.py	Mon Jan 21 03:37:06 2019 +0100
+++ b/kallithea/tests/other/test_vcs_operations.py	Mon Jan 21 03:39:26 2019 +0100
@@ -352,6 +352,8 @@
 
     @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])]
+
         key = CacheInvalidation.query().filter(CacheInvalidation.cache_key
                                                == testfork[vt.repo_type]).scalar()
         if not key:
@@ -369,6 +371,10 @@
 
         if vt.repo_type == 'git':
             _check_proper_git_push(stdout, stderr)
+
+        post_cached_tip = [repo.get_api_data()['last_changeset']['short_id'] for repo in Repository.query().filter(Repository.repo_name == testfork[vt.repo_type])]
+        assert pre_cached_tip != post_cached_tip
+
         key = CacheInvalidation.query().filter(CacheInvalidation.cache_key
                                                == testfork[vt.repo_type]).all()
         assert key == []