Adapt isolated removal preview tests to verified configuration reader

This commit is contained in:
Jonatan
2026-10-17 18:50:42 +02:00
parent 6496318452
commit 99adc343e8
@@ -5,6 +5,7 @@ import json
from pathlib import Path from pathlib import Path
import re import re
import runpy import runpy
import subprocess
import sys import sys
import tempfile import tempfile
from types import ModuleType, SimpleNamespace from types import ModuleType, SimpleNamespace
@@ -52,7 +53,8 @@ class InventoryMessages(unittest.TestCase):
state = ModuleType('oci_installation_state') state = ModuleType('oci_installation_state')
state.parse_config = lambda raw: dict(line.split(': ', 1) for line in raw.decode().splitlines()) state.parse_config = lambda raw: dict(line.split(': ', 1) for line in raw.decode().splitlines())
scope = {'sys': SimpleNamespace(path=[]), 'source_text': lambda text: text or '', scope = {'sys': SimpleNamespace(path=[]), 'source_text': lambda text: text or '',
'translate': translate, 're': re} 'translate': translate, 're': re, 'subprocess': subprocess,
'_selected_configuration': remover.guest_config}
summary = extracted(MENU, '_removal_summary', scope) summary = extracted(MENU, '_removal_summary', scope)
with patch.dict(sys.modules, {'oci_instances': instances, 'oci_remove': remover, with patch.dict(sys.modules, {'oci_instances': instances, 'oci_remove': remover,
'oci_installation_state': state}): 'oci_installation_state': state}):