fix: bind manual recovery entries and current native diagnostics
This commit is contained in:
1 parent
8374cabe5c
commit
601dd7b6b2
14 files changed
+694
-69
No files matched your search
@@ -8,6 +8,11 @@ import win32con
|
||||
import win32file
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def no_real_owner_probe(monkeypatch):
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda names: [])
|
||||
|
||||
|
||||
def project_fixture(tmp_path):
|
||||
from cbb_refresh_verify.verify_runner import VerifyRequest
|
||||
library = tmp_path/'library/library.lmc'; library.parent.mkdir(); library.touch()
|
||||
@@ -21,6 +26,9 @@ def test_backup_entry_can_open_project_without_layout_data(tmp_path, monkeypatch
|
||||
request, project = project_fixture(tmp_path)
|
||||
executable = tmp_path/'iCDBProjectBackup.exe'; executable.touch()
|
||||
monkeypatch.setattr(native, 'native_backup_executable', lambda *_: executable)
|
||||
from cbb_refresh_verify import session_record
|
||||
monkeypatch.setattr(session_record, 'process_identity', lambda pid:
|
||||
dict(pid=pid, created='fixture', executable='python.exe', owner='fixture'))
|
||||
calls = []
|
||||
monkeypatch.setattr(native.subprocess, 'Popen', lambda command, **kw:
|
||||
(calls.append(command) or SimpleNamespace(pid=123, poll=lambda: None)))
|
||||
@@ -32,7 +40,8 @@ def test_backup_entry_can_open_project_without_layout_data(tmp_path, monkeypatch
|
||||
assert session.library == request.lmc_file and session.block == 'Block'
|
||||
|
||||
|
||||
def test_native_session_closure_does_not_claim_restore_success(tmp_path, monkeypatch):
|
||||
@pytest.mark.parametrize('mode', ['versions', 'repair'])
|
||||
def test_native_session_closure_does_not_claim_restore_success(tmp_path, monkeypatch, mode):
|
||||
from cbb_refresh_verify import native_backup as native
|
||||
from cbb_refresh_verify.library_lock import LibraryLock
|
||||
request, project = project_fixture(tmp_path)
|
||||
@@ -40,7 +49,7 @@ def test_native_session_closure_does_not_claim_restore_success(tmp_path, monkeyp
|
||||
monkeypatch.setattr(native, 'native_backup_executable', lambda *_: executable)
|
||||
job = request.evidence_dir/'request.json'; job.parent.mkdir()
|
||||
job.write_text(json.dumps({'library': str(request.lmc_file), 'block': 'Block',
|
||||
'project': str(project), 'mentor_bin': ''}))
|
||||
'project': str(project), 'mentor_bin': '', 'mode': mode}))
|
||||
calls = []
|
||||
class NativeProcess:
|
||||
pid = 456
|
||||
@@ -58,6 +67,8 @@ def test_native_session_closure_does_not_claim_restore_success(tmp_path, monkeyp
|
||||
result = json.loads(job.with_name('result.json').read_text('utf-8'))
|
||||
assert result['status'] == 'CLOSED' and result['restore_confirmed'] is False
|
||||
assert result['native_exit_code'] == 0 and result['safe_to_continue'] is True
|
||||
assert result['mode'] == mode and result['repair_confirmed'] is False
|
||||
assert result['validation_passed'] is False
|
||||
with LibraryLock(request.lmc_file): pass
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user