fix: restrict explicit force release to verified user document clients
This commit is contained in:
1 parent
e4266ae88c
commit
e53c5d0e92
18 files changed
+2090
-1623
No files matched your search
@@ -81,7 +81,8 @@ def test_force_close_is_explicit_and_cancel_does_not_release(qtbot, tmp_path, mo
|
||||
from cbb_refresh_verify import library_lock
|
||||
from cbb_refresh_verify.ui.residual_release_dialog import ResidualReleaseDialog
|
||||
plan = {'library': str(tmp_path/'lib.lmc'), 'sessions': [
|
||||
{'project': 'A', 'name': 'ExpeditionPCB.exe', 'pid': 10, 'detail': '窗口无响应'}]}
|
||||
{'project': 'A', 'name': 'ExpeditionPCB.exe', 'pid': 10, 'detail': '窗口无响应',
|
||||
'scope_confirmed': True, 'owner_sid': 'S-1-current', 'session_id': 1, 'force_user_confirmed': True, 'image': 'C:/Mentor/ExpeditionPCB.exe', 'created_handle': 'creation'}]}
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions', lambda *_: plan)
|
||||
calls = []
|
||||
def release(actual, *a, **kw):
|
||||
@@ -100,6 +101,31 @@ def test_force_close_is_explicit_and_cancel_does_not_release(qtbot, tmp_path, mo
|
||||
assert calls == [True]
|
||||
|
||||
|
||||
def test_force_confirmation_excludes_shared_servers(qtbot, tmp_path, monkeypatch):
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
from cbb_refresh_verify import library_lock
|
||||
from cbb_refresh_verify.ui.residual_release_dialog import ResidualReleaseDialog
|
||||
rows = [{'project': 'A', 'name': name, 'pid': pid, 'scope_confirmed': True, 'owner_sid': 'S-1-current', 'session_id': 1, 'force_user_confirmed': True,
|
||||
'image': 'C:/Mentor/'+name, 'created_handle': str(pid), 'detail': 'waiting'}
|
||||
for name, pid in [('icdbserver.exe', 10), ('ExpeditionPCB.exe', 20)]]
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions', lambda *_: {
|
||||
'library': str(tmp_path/'lib.lmc'), 'sessions': rows})
|
||||
dialog = ResidualReleaseDialog(tmp_path/'lib.lmc', tmp_path/'evidence')
|
||||
qtbot.addWidget(dialog)
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
messages = []
|
||||
monkeypatch.setattr(QMessageBox, 'warning', lambda parent, title, text, *args:
|
||||
messages.append(text) or QMessageBox.Cancel)
|
||||
dialog.force_button.click()
|
||||
assert len(messages) == 1
|
||||
assert 'ExpeditionPCB.exe' in messages[0]
|
||||
assert 'icdbserver.exe' not in messages[0]
|
||||
assert '服务器' in messages[0]
|
||||
dialog.plan['sessions'] = [rows[0]]
|
||||
dialog._finished()
|
||||
assert not dialog.force_button.isEnabled()
|
||||
|
||||
|
||||
def test_released_batch_can_resume_only_its_unexecuted_items(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
|
||||
Reference in new issue
Block a user