"""Tests for finalize-job handler.""" import pytest from pytest_mock import MockerFixture from src.index import handler def test_handler_patches_job_completed(mocker: MockerFixture) -> None: mock_patch = mocker.patch("src.index.patch_transfer_job") result = handler({"job_id": 42}, object()) assert result == {"statusCode": 200} mock_patch.assert_called_once_with(42, {"status": "COMPLETED"}) def test_handler_raises_on_missing_job_id() -> None: with pytest.raises(KeyError): handler({}, object()) def test_handler_raises_on_invalid_job_id() -> None: with pytest.raises(ValueError, match="must be an integer"): handler({"job_id": "not-an-int"}, object())