PYTHON
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import pytest
|
||||
import pytest
|
||||
from unittest.mock import MagicMock, patch
|
||||
from pathlib import Path
|
||||
|
||||
@@ -32,9 +32,9 @@ history = []
|
||||
|
||||
@pytest.fixture
|
||||
def app_instance(mock_config: Path, mock_project: Path, monkeypatch: pytest.MonkeyPatch) -> App:
|
||||
monkeypatch.setattr("gui_2.CONFIG_PATH", mock_config)
|
||||
with patch("project_manager.load_project") as mock_load, \
|
||||
patch("session_logger.open_session"):
|
||||
monkeypatch.setattr("src.models.CONFIG_PATH", mock_config)
|
||||
with patch("src.project_manager.load_project") as mock_load, \
|
||||
patch("src.session_logger.open_session"):
|
||||
mock_load.return_value = {
|
||||
"project": {"name": "test"},
|
||||
"discussion": {"roles": ["User", "AI"], "active": "main", "discussions": {"main": {"history": []}}},
|
||||
@@ -63,19 +63,19 @@ def test_render_log_management_logic(app_instance: App) -> None:
|
||||
app = app_instance
|
||||
app.show_windows["Log Management"] = True
|
||||
# Mock LogRegistry
|
||||
with patch("gui_2.LogRegistry") as MockRegistry, \
|
||||
patch("gui_2.imgui.begin") as mock_begin, \
|
||||
patch("gui_2.imgui.begin_table") as mock_begin_table, \
|
||||
patch("gui_2.imgui.text") as mock_text, \
|
||||
patch("gui_2.imgui.end_table"), \
|
||||
patch("gui_2.imgui.end"), \
|
||||
patch("gui_2.imgui.push_style_color"), \
|
||||
patch("gui_2.imgui.pop_style_color"), \
|
||||
patch("gui_2.imgui.table_setup_column"), \
|
||||
patch("gui_2.imgui.table_headers_row"), \
|
||||
patch("gui_2.imgui.table_next_row"), \
|
||||
patch("gui_2.imgui.table_next_column"), \
|
||||
patch("gui_2.imgui.button"):
|
||||
with patch("src.log_registry.LogRegistry") as MockRegistry, \
|
||||
patch("src.gui_2.imgui.begin") as mock_begin, \
|
||||
patch("src.gui_2.imgui.begin_table") as mock_begin_table, \
|
||||
patch("src.gui_2.imgui.text") as mock_text, \
|
||||
patch("src.gui_2.imgui.end_table"), \
|
||||
patch("src.gui_2.imgui.end"), \
|
||||
patch("src.gui_2.imgui.push_style_color"), \
|
||||
patch("src.gui_2.imgui.pop_style_color"), \
|
||||
patch("src.gui_2.imgui.table_setup_column"), \
|
||||
patch("src.gui_2.imgui.table_headers_row"), \
|
||||
patch("src.gui_2.imgui.table_next_row"), \
|
||||
patch("src.gui_2.imgui.table_next_column"), \
|
||||
patch("src.gui_2.imgui.button"):
|
||||
mock_reg = MockRegistry.return_value
|
||||
mock_reg.data = {
|
||||
"session_1": {
|
||||
|
||||
Reference in New Issue
Block a user