mirror of
https://github.com/Quad4-Software/MeshChatX.git
synced 2026-08-18 09:49:09 -04:00
fix(tests): update memory mock values in tests for accurate evaluation and adjust assertions for boolean checks
This commit is contained in:
parent
ec72c62af7
commit
8aa91b9fb6
4 changed files with 3915 additions and 3903 deletions
|
|
@ -3,4 +3,4 @@
|
|||
"""Reticulum MeshChatX - A mesh network communications app."""
|
||||
|
||||
# Synced from package.json via scripts/sync_version.js (also writes meshchatx/src/version.py).
|
||||
__version__ = "4.7.0"
|
||||
__version__ = "4.7.0"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -30,7 +30,7 @@ def test_evaluate_startup_memory_ok():
|
|||
def test_evaluate_startup_memory_warn_on_low_total():
|
||||
with patch(
|
||||
"meshchatx.src.backend.recovery.memory_preflight.psutil.virtual_memory",
|
||||
return_value=_mock_memory(4096, 900, 78),
|
||||
return_value=_mock_memory(4096, 900, 86),
|
||||
):
|
||||
result = evaluate_startup_memory(emergency=False)
|
||||
assert result["action"] == "warn"
|
||||
|
|
@ -79,4 +79,4 @@ def test_format_and_parse_memory_log_line():
|
|||
parsed = parse_memory_log_line(f"booting\n{line}\n")
|
||||
assert parsed["available_mb"] == 512.5
|
||||
assert parsed["action"] == "warn"
|
||||
assert parsed["emergency"] == "false"
|
||||
assert parsed["emergency"] is False
|
||||
|
|
|
|||
|
|
@ -208,6 +208,18 @@ def test_identity_loading_fallback(mock_rns, temp_dir):
|
|||
patch("RNS.Identity") as mock_id_class,
|
||||
patch("os.path.exists", return_value=False), # Pretend files don't exist
|
||||
patch("builtins.open", mock_open()) as mock_file,
|
||||
patch(
|
||||
"meshchatx.meshchat.evaluate_startup_memory",
|
||||
return_value={
|
||||
"total_mb": 8192.0,
|
||||
"available_mb": 4096.0,
|
||||
"percent_used": 50.0,
|
||||
"action": "ok",
|
||||
"message": "",
|
||||
"emergency_requested": False,
|
||||
"low_memory": False,
|
||||
},
|
||||
),
|
||||
):
|
||||
mock_config = mock_config_class.return_value
|
||||
mock_config.auth_session_secret.get.return_value = "test_secret"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue