python-dependency-injector/examples/miniapps/use_cases/containers.py
Roman Mogylatov c50322db02
178 dependencies container provider (#179)
* Add DependenciesContainer provider

* Remove bundles_v2 example

* Add use cases example

* Update changelog

* Update documentation requirements to use fixed version of sphinxcontrib-disqus

* Add use cases miniapp to docs

* Update changelog
2018-01-21 23:55:32 +02:00

31 lines
818 B
Python

"""Dependency injection containers for 'Use Cases' example application."""
from dependency_injector import containers, providers
from example.adapters import SmtpEmailSender, EchoEmailSender
from example.use_cases import SignupUseCase
class Adapters(containers.DeclarativeContainer):
"""Adapters container."""
email_sender = providers.Singleton(SmtpEmailSender)
class TestAdapters(containers.DeclarativeContainer):
"""Adapters container.
This container is used for testing purposes.
"""
email_sender = providers.Singleton(EchoEmailSender)
class UseCases(containers.DeclarativeContainer):
"""Use cases container."""
adapters = providers.DependenciesContainer()
signup = providers.Factory(SignupUseCase,
email_sender=adapters.email_sender)