diff --git a/backend/lcfs/db/migrations/versions/2024-12-09-22-33_cd8698fe40e6.py b/backend/lcfs/db/migrations/versions/2024-12-09-22-33_cd8698fe40e6.py index 3a512b338..8ec2b8223 100644 --- a/backend/lcfs/db/migrations/versions/2024-12-09-22-33_cd8698fe40e6.py +++ b/backend/lcfs/db/migrations/versions/2024-12-09-22-33_cd8698fe40e6.py @@ -11,7 +11,7 @@ # revision identifiers, used by Alembic. revision = "cd8698fe40e6" -down_revision = "7ae38a8413ab" +down_revision = "9206124a098b" branch_labels = None depends_on = None diff --git a/backend/lcfs/db/migrations/versions/2024-12-09-19-31_7ae38a8413ab.py b/backend/lcfs/db/migrations/versions/2024-12-09-23-31_7ae38a8413ab.py similarity index 98% rename from backend/lcfs/db/migrations/versions/2024-12-09-19-31_7ae38a8413ab.py rename to backend/lcfs/db/migrations/versions/2024-12-09-23-31_7ae38a8413ab.py index 0f422117e..51856f8c4 100644 --- a/backend/lcfs/db/migrations/versions/2024-12-09-19-31_7ae38a8413ab.py +++ b/backend/lcfs/db/migrations/versions/2024-12-09-23-31_7ae38a8413ab.py @@ -12,7 +12,7 @@ # revision identifiers, used by Alembic. revision = "7ae38a8413ab" -down_revision = "9206124a098b" +down_revision = "cd8698fe40e6" branch_labels = None depends_on = None diff --git a/backend/lcfs/tests/other_uses/test_other_uses_repo.py b/backend/lcfs/tests/other_uses/test_other_uses_repo.py index 8ef79cd70..67ea7d1d5 100644 --- a/backend/lcfs/tests/other_uses/test_other_uses_repo.py +++ b/backend/lcfs/tests/other_uses/test_other_uses_repo.py @@ -233,9 +233,14 @@ async def test_get_other_use_version_by_user(other_uses_repo, mock_db_session): mock_other_use.version = version mock_other_use.user_type = user_type - mock_db_session.execute.return_value.scalars.return_value.first.return_value = ( - mock_other_use - ) + # Set up mock result chain + mock_result = AsyncMock() + mock_result.scalars = MagicMock(return_value=mock_result) + mock_result.first = MagicMock(return_value=mock_other_use) + + # Configure mock db session + mock_db_session.execute = AsyncMock(return_value=mock_result) + other_uses_repo.db = mock_db_session result = await other_uses_repo.get_other_use_version_by_user( group_uuid, version, user_type diff --git a/backend/lcfs/web/api/other_uses/repo.py b/backend/lcfs/web/api/other_uses/repo.py index 9f49a3d5d..8e515b484 100644 --- a/backend/lcfs/web/api/other_uses/repo.py +++ b/backend/lcfs/web/api/other_uses/repo.py @@ -302,7 +302,7 @@ async def get_other_use_version_by_user( ) result = await self.db.execute(query) - return await result.scalars().first() + return result.scalars().first() @repo_handler async def get_formatted_fuel_types(self) -> List[Dict[str, Any]]: