- Remove Skyvern service + DB from docker-compose.yml
- Remove cron/browser_executor.py and pipelines/steps/skyvern.py
- Remove browser_scrape from cron executor dispatch
- Update tests to reflect Skyvern removal
- Fix test_needs_query_rewrite false positive ('das' is a valid trigger)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
"""Tests for the cron executor dispatch."""
|
|
|
|
from unittest.mock import AsyncMock
|
|
|
|
import pytest
|
|
|
|
from cron.executor import execute_job
|
|
|
|
|
|
class TestExecuteJob:
|
|
@pytest.mark.asyncio
|
|
async def test_unknown_job_type_returns_error(self):
|
|
job = {"jobType": "nonexistent", "config": {}}
|
|
result = await execute_job(
|
|
job=job, send_text=AsyncMock(), matrix_client=None
|
|
)
|
|
assert result["status"] == "error"
|
|
assert "Unknown job type" in result["error"]
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_dispatches_to_reminder(self):
|
|
job = {
|
|
"id": "j1",
|
|
"name": "Test Reminder",
|
|
"jobType": "reminder",
|
|
"config": {"message": "Don't forget!"},
|
|
"targetRoom": "!room:test",
|
|
}
|
|
send_text = AsyncMock()
|
|
result = await execute_job(job=job, send_text=send_text, matrix_client=None)
|
|
assert result["status"] == "success"
|
|
send_text.assert_called_once()
|
|
assert "Don't forget!" in send_text.call_args[0][1]
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_unknown_browser_scrape_returns_error(self):
|
|
"""browser_scrape was removed (Skyvern archived), should fail as unknown."""
|
|
job = {
|
|
"id": "j1",
|
|
"name": "Scrape Test",
|
|
"jobType": "browser_scrape",
|
|
"config": {"url": "https://example.com"},
|
|
"targetRoom": "!room:test",
|
|
}
|
|
send_text = AsyncMock()
|
|
result = await execute_job(job=job, send_text=send_text, matrix_client=None)
|
|
assert result["status"] == "error"
|
|
assert "Unknown job type" in result["error"]
|