# HG changeset patch # User Mads Kiilerich # Date 2019-01-21 03:39:26 # Node ID b8551ceab4481f9c8ab259ab795f86a3b81aa434 # Parent f8c0549df5296493aab489c1aee647cdf8a1b709 tests: verify in vcs test_push_invalidates_cache that the push hook actually updates the cache diff --git a/kallithea/tests/other/test_vcs_operations.py b/kallithea/tests/other/test_vcs_operations.py --- a/kallithea/tests/other/test_vcs_operations.py +++ b/kallithea/tests/other/test_vcs_operations.py @@ -352,6 +352,8 @@ class TestVCSOperations(TestController): @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 @@ class TestVCSOperations(TestController): 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 == []