File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323)
2424
2525
26- def get_database () -> Database :
27- return database
28-
29-
3026engine = create_engine (
3127 DATABASE_URL ,
3228 pool_size = settings .app_db_min_con ,
Original file line number Diff line number Diff line change 66from sqlmodel .ext .asyncio .session import AsyncSession
77
88from app .db .database_config import (
9- get_database ,
9+ database ,
1010 create_session ,
1111 create_async_session ,
1212)
1313
1414
1515def get_database_dep () -> Database :
16- return get_database ()
16+ return database
1717
1818
1919DatabaseDep = Annotated [Database , Depends (get_database_dep )]
Original file line number Diff line number Diff line change 2020import app .dao .sample_jsonb_sql_dao as sample_jsonb_sql_dao
2121import app .dao .sample_sql_dao as sample_sql_dao
2222import app .db .database_config as database_config
23+ import app .db .database_dependencies as database_dependencies
2324import app .main as main
2425
2526DB_MODULES_TO_RELOAD = [
2627 database_config ,
28+ database_dependencies ,
2729 sample_sql_dao ,
2830 sample_jsonb_sql_dao ,
2931]
Original file line number Diff line number Diff line change @@ -38,11 +38,8 @@ def test_client(
3838
3939@pytest .fixture
4040def mock_get_database (mocker : MockerFixture ) -> MagicMock :
41- mock_get_database : MagicMock = mocker .patch (
42- "app.db.database_dependencies.get_database"
43- )
4441 mock_database = MagicMock (spec = Database )
45- mock_get_database . return_value = mock_database
42+ mocker . patch ( "app.db.database_dependencies.database" , mock_database )
4643 return mock_database
4744
4845
You can’t perform that action at this time.
0 commit comments