mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-08-17 16:37:30 +02:00
Cover legacy console fallbacks, platform temp paths, local UI disk probing, and lazy analysis exports. Bind the new local UI test to the executable source-to-test risk map.
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Portable local-launcher rendering and filesystem contracts."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from unittest.mock import Mock
|
|
|
|
from obliteratus import local_ui
|
|
|
|
|
|
class _EncodingOnlyStdout:
|
|
def __init__(self, encoding: str | None) -> None:
|
|
self.encoding = encoding
|
|
|
|
|
|
def test_local_ui_banner_degrades_to_ascii_on_cp1252(monkeypatch):
|
|
monkeypatch.setattr(local_ui.sys, "stdout", _EncodingOnlyStdout("cp1252"))
|
|
banner = local_ui._banner_for_console()
|
|
assert "OBLITERATUS" in banner
|
|
assert banner.isascii()
|
|
|
|
|
|
def test_local_ui_banner_keeps_block_art_on_utf8(monkeypatch):
|
|
monkeypatch.setattr(local_ui.sys, "stdout", _EncodingOnlyStdout("utf-8"))
|
|
assert "░" in local_ui._banner_for_console()
|
|
|
|
|
|
def test_system_info_queries_the_platform_temp_directory(monkeypatch, tmp_path):
|
|
disk_free = Mock(return_value=12.5)
|
|
monkeypatch.setattr(local_ui.tempfile, "gettempdir", lambda: str(tmp_path))
|
|
monkeypatch.setattr(local_ui, "_get_disk_free_gb", disk_free)
|
|
monkeypatch.setattr(local_ui, "console", Mock())
|
|
|
|
local_ui._print_system_info([])
|
|
|
|
disk_free.assert_called_once_with(str(tmp_path))
|