mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Add providers overriding to demo 2
This commit is contained in:
parent
88866d596b
commit
684745a6b4
|
@ -1,4 +1,5 @@
|
|||
from dependency_injector import containers, providers
|
||||
from unittest import mock
|
||||
|
||||
|
||||
class ApiClient:
|
||||
|
@ -35,5 +36,9 @@ if __name__ == '__main__':
|
|||
container.config.from_yaml('config.yml')
|
||||
|
||||
service = container.service()
|
||||
|
||||
assert isinstance(service.api_client, ApiClient)
|
||||
|
||||
with container.api_client.override(mock.Mock()):
|
||||
service = container.service()
|
||||
assert isinstance(service.api_client, mock.Mock)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user