fix(tests): use the perm setter with cleanup

This commit is contained in:
RhodeCode Admin 2026-01-19 08:44:26 +01:00
parent 83e8eded56
commit 67bc6a188a

View file

@ -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)