mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-26 03:23:58 +03:00
Replace AsyncMock with simple mock class in FastAPI wiring tests for better compatibility
This commit is contained in:
parent
0b7cf3254e
commit
c1e53e5edd
|
@ -80,10 +80,11 @@ class WiringFastAPITest(AsyncTestCase):
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|
||||||
def test_depends_marker_injection(self):
|
def test_depends_marker_injection(self):
|
||||||
service_mock = mock.AsyncMock(spec=web.Service)
|
class ServiceMock:
|
||||||
service_mock.process.return_value = 'Foo'
|
async def process(self):
|
||||||
|
return 'Foo'
|
||||||
|
|
||||||
with web.container.service.override(service_mock):
|
with web.container.service.override(ServiceMock()):
|
||||||
response = self._run(self.client.get('/'))
|
response = self._run(self.client.get('/'))
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user