| 123456789101112131415161718 |
- import pytest
- from unittest.mock import AsyncMock, MagicMock, patch
- from app.use_cases.camoufox.visit import VisitUseCase
- class TestVisitUseCase:
- @patch("app.use_cases.camoufox.visit.CamoufoxWrapper")
- def test_execute_calls_wrapper_visit(self, mock_wrapper_class):
- mock_wrapper = MagicMock()
- mock_wrapper.visit = AsyncMock(return_value={"html": "<html>", "screenshot": None})
- mock_wrapper_class.return_value = mock_wrapper
- use_case = VisitUseCase()
- import asyncio
- result = asyncio.run(use_case.execute("https://example.com", {}))
- mock_wrapper.visit.assert_called_once_with("https://example.com", {})
- assert result == {"html": "<html>", "screenshot": None}
|