feat: Add method to get extractions by status and implement user info retrieval in extraction service
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user