File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 44from starlette .routing import Mount , Route , Router
55
66from common import AppConfig , application_init
7+ from common .di_container import Container
78from common .telemetry import instrument_third_party
89from socketio_app .namespaces .chat import ChatNamespace
910from socketio_app .web_routes import docs
1516
1617def create_app (
1718 test_config : Union [AppConfig , None ] = None ,
19+ test_di_container : Union [Container , None ] = None ,
1820) -> Router :
1921 _config = test_config or AppConfig ()
20- application_init (_config )
22+ application_init (_config , test_di_container )
2123
2224 # SocketIO App
2325 sio = socketio .AsyncServer (async_mode = "asgi" )
Original file line number Diff line number Diff line change 1+ from collections .abc import Iterator
2+ from unittest .mock import patch
3+
4+ import pytest
5+ from dependency_injector .providers import Object
6+ from starlette .routing import Router
7+
8+ from common .di_container import Container
9+ from socketio_app import create_app
10+
11+
12+ @pytest .fixture (scope = "session" )
13+ def test_di_container (test_config ) -> Container :
14+ return Container (
15+ config = Object (test_config ),
16+ )
17+
18+
19+ @pytest .fixture (scope = "session" )
20+ def testapp (test_config , test_di_container ) -> Iterator [Router ]:
21+ # We don't need the storage to test the HTTP app
22+ with patch ("common.bootstrap.init_storage" , return_value = None ):
23+ app = create_app (test_config = test_config , test_di_container = test_di_container )
24+ yield app
You can’t perform that action at this time.
0 commit comments