From 67bc6a188a01b40d09aba6b1cffde7f688097745 Mon Sep 17 00:00:00 2001 From: RhodeCode Admin Date: Mon, 19 Jan 2026 08:44:26 +0100 Subject: [PATCH] fix(tests): use the perm setter with cleanup --- .../test_vcs_operations_bad_client.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/rhodecode/tests/vcs_operations/test_vcs_operations_bad_client.py b/rhodecode/tests/vcs_operations/test_vcs_operations_bad_client.py index db8ad4ce..366b948f 100644 --- a/rhodecode/tests/vcs_operations/test_vcs_operations_bad_client.py +++ b/rhodecode/tests/vcs_operations/test_vcs_operations_bad_client.py @@ -54,16 +54,14 @@ def bad_client_setter_factory(request): "disable_locking", ) class TestVCSOperationsOnUsingBadClient(object): - def test_push_with_bad_client_repo_by_other_user_hg(self, rcstack, tmpdir): + def test_push_with_bad_client_repo_by_other_user_hg(self, rcstack, tmpdir, bad_client_setter_factory): clone_url = rcstack.repo_clone_url(HG_REPO) stdout, stderr = Command(tmpdir.strpath).execute("hg clone", clone_url, tmpdir.strpath) # set allowed clients - setting = SettingsModel().create_or_update_setting(name="hg_allowed_clients", val="0.0.0") - Session().add(setting) - Session().commit() + bad_client_setter_factory("hg", "0.0.0") - # push fails repo is locked by other user ! + # push fails repo is locked by another user! push_url = rcstack.repo_clone_url(HG_REPO) stdout, stderr = _add_files_and_push("hg", tmpdir.strpath, clone_url=push_url) current_version = version("mercurial") @@ -72,16 +70,14 @@ class TestVCSOperationsOnUsingBadClient(object): ) assert msg in stderr - def test_push_with_bad_client_repo_by_other_user_git(self, rcstack, tmpdir): + def test_push_with_bad_client_repo_by_other_user_git(self, rcstack, tmpdir, bad_client_setter_factory): clone_url = rcstack.repo_clone_url(GIT_REPO) stdout, stderr = Command(tmpdir.strpath).execute("git clone", clone_url, tmpdir.strpath) # set allowed clients - setting = SettingsModel().create_or_update_setting(name="git_allowed_clients", val="0.0.0") - Session().add(setting) - Session().commit() + bad_client_setter_factory("git", "0.0.0") - # push fails repo is locked by other user! + # push fails repo is locked by another user! push_url = rcstack.repo_clone_url(GIT_REPO) stdout, stderr = _add_files_and_push("git", tmpdir.strpath, clone_url=push_url)