7a0da7932b
Backwards Compatibility / Verify Encryption Constants (push) Waiting to run
Backwards Compatibility / PyPI Version Compatibility (push) Waiting to run
Backwards Compatibility / Database Migration Tests (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Blocked by required conditions
Docker Tests (Consolidated) / detect-changes (push) Waiting to run
Docker Tests (Consolidated) / Build Test Image (push) Waiting to run
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Blocked by required conditions
Docker Tests (Consolidated) / Accessibility Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Unit Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Example Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / Production Image Smoke Test (push) Blocked by required conditions
Docker Tests (Consolidated) / Infrastructure Tests (push) Blocked by required conditions
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Waiting to run
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
107 lines
2.9 KiB
Python
107 lines
2.9 KiB
Python
"""Fixtures for API module tests."""
|
|
|
|
import pytest
|
|
from unittest.mock import MagicMock, patch
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_llm():
|
|
"""Create a mock LLM."""
|
|
mock = MagicMock()
|
|
mock.invoke.return_value = MagicMock(content="Mocked LLM response")
|
|
return mock
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_search_engine():
|
|
"""Create a mock search engine."""
|
|
mock = MagicMock()
|
|
mock.run.return_value = [
|
|
{
|
|
"title": "Result 1",
|
|
"link": "https://example.com/1",
|
|
"snippet": "Snippet 1",
|
|
},
|
|
{
|
|
"title": "Result 2",
|
|
"link": "https://example.com/2",
|
|
"snippet": "Snippet 2",
|
|
},
|
|
]
|
|
return mock
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_search_system():
|
|
"""Create a mock AdvancedSearchSystem."""
|
|
mock = MagicMock()
|
|
mock.analyze_topic.return_value = {
|
|
"current_knowledge": "Summary of findings",
|
|
"findings": [{"content": "Finding 1"}, {"content": "Finding 2"}],
|
|
"iterations": 2,
|
|
"questions": {"1": ["Q1", "Q2"]},
|
|
"formatted_findings": "Formatted findings text",
|
|
"all_links_of_system": [
|
|
{"title": "Source 1", "link": "https://example.com/1"},
|
|
],
|
|
}
|
|
mock.max_iterations = 2
|
|
mock.questions_per_iteration = 3
|
|
mock.model = MagicMock()
|
|
return mock
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_report_generator():
|
|
"""Create a mock report generator."""
|
|
mock = MagicMock()
|
|
mock.generate_report.return_value = {
|
|
"content": "# Report\n\nReport content",
|
|
"metadata": {"generated": "2024-01-01T00:00:00Z"},
|
|
}
|
|
return mock
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_settings_snapshot():
|
|
"""Create a sample settings snapshot."""
|
|
return {
|
|
"llm.provider": {"value": "ollama", "ui_element": "select"},
|
|
"llm.model": {"value": "gemma3:12b", "ui_element": "text"},
|
|
"llm.temperature": {"value": 0.7, "ui_element": "range"},
|
|
"search.tool": {"value": "searxng", "ui_element": "select"},
|
|
"search.iterations": {"value": 2, "ui_element": "number"},
|
|
"search.questions_per_iteration": {"value": 3, "ui_element": "number"},
|
|
"search.max_results": {"value": 20, "ui_element": "number"},
|
|
}
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_get_llm(mock_llm):
|
|
"""Mock get_llm function."""
|
|
with patch(
|
|
"local_deep_research.api.research_functions.get_llm",
|
|
return_value=mock_llm,
|
|
):
|
|
yield mock_llm
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_get_search(mock_search_engine):
|
|
"""Mock get_search function."""
|
|
with patch(
|
|
"local_deep_research.api.research_functions.get_search",
|
|
return_value=mock_search_engine,
|
|
):
|
|
yield mock_search_engine
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_advanced_search_system(mock_search_system):
|
|
"""Mock AdvancedSearchSystem class."""
|
|
with patch(
|
|
"local_deep_research.api.research_functions.AdvancedSearchSystem",
|
|
return_value=mock_search_system,
|
|
):
|
|
yield mock_search_system
|