feat: Add method to get extractions by status and implement user info retrieval in extraction service
Some checks failed
Backend CI / lint (push) Failing after 4m53s
Backend CI / test (push) Failing after 4m31s

This commit is contained in:
JSC
2025-08-24 13:24:48 +02:00
parent 28faca55bc
commit 16eb789539
5 changed files with 177 additions and 10 deletions

View File

@@ -129,3 +129,36 @@ class TestExtractionRepository:
assert result.sound_id == TEST_SOUND_ID
extraction_repo.session.commit.assert_called_once()
extraction_repo.session.refresh.assert_called_once_with(extraction)
@pytest.mark.asyncio
async def test_get_by_status(self, extraction_repo):
"""Test getting extractions by status."""
mock_extractions = [
Extraction(
id=1,
service="youtube",
service_id="test123",
url="https://www.youtube.com/watch?v=test1",
user_id=1,
status="processing",
),
Extraction(
id=2,
service="youtube",
service_id="test456",
url="https://www.youtube.com/watch?v=test2",
user_id=1,
status="processing",
),
]
mock_result = Mock()
mock_result.all.return_value = mock_extractions
extraction_repo.session.exec = AsyncMock(return_value=mock_result)
result = await extraction_repo.get_by_status("processing")
assert len(result) == 2
assert all(extraction.status == "processing" for extraction in result)
extraction_repo.session.exec.assert_called_once()