# HG changeset patch # User RhodeCode Admin # Date 2024-02-08 16:07:44 # Node ID e8e7c9272584e90700658f3937cea0dca564f3b6 # Parent c778c694eb58551449248320eeaf2b9108d478d1 fix(tests): fixed tests for vcs-operations diff --git a/rhodecode/tests/vcs_operations/test_vcs_operations.py b/rhodecode/tests/vcs_operations/test_vcs_operations.py --- a/rhodecode/tests/vcs_operations/test_vcs_operations.py +++ b/rhodecode/tests/vcs_operations/test_vcs_operations.py @@ -248,7 +248,7 @@ class TestVCSOperations(object): # init cache objects CacheKey.delete_all_cache() - cache_namespace_uid = 'cache_push_test.{}'.format(hg_repo.repo_id) + repo_namespace_key = CacheKey.REPO_INVALIDATION_NAMESPACE.format(repo_id=hg_repo.repo_id) inv_context_manager = rc_cache.InvalidationContext(key=repo_namespace_key) @@ -257,6 +257,10 @@ class TestVCSOperations(object): # __enter__ will create and register cache objects pass + cache_keys = hg_repo.cache_keys + assert cache_keys != [] + old_ids = [x.cache_state_uid for x in cache_keys] + # clone to init cache clone_url = rc_web_server.repo_clone_url(hg_repo.repo_name) stdout, stderr = Command('/tmp').execute( @@ -276,9 +280,8 @@ class TestVCSOperations(object): hg_repo = Repository.get_by_repo_name(HG_REPO) cache_keys = hg_repo.cache_keys assert cache_keys != [] - for key in cache_keys: - # keys should be marked as not active - assert key.cache_active is False + new_ids = [x.cache_state_uid for x in cache_keys] + assert new_ids != old_ids def test_push_wrong_credentials_hg(self, rc_web_server, tmpdir): clone_url = rc_web_server.repo_clone_url(HG_REPO)