mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Add tests for @providers.override decorator
This commit is contained in:
parent
86ef17c75a
commit
37fde8e97c
|
@ -1113,3 +1113,18 @@ class FactoryAsDecoratorTests(unittest.TestCase):
|
||||||
|
|
||||||
self.assertIsInstance(users_service, UsersService.cls)
|
self.assertIsInstance(users_service, UsersService.cls)
|
||||||
self.assertIsInstance(users_service.auth_service, AuthService.cls)
|
self.assertIsInstance(users_service.auth_service, AuthService.cls)
|
||||||
|
|
||||||
|
def test_decoration_and_overriding(self):
|
||||||
|
"""Test decoration of some class with Factory provider."""
|
||||||
|
@providers.Factory
|
||||||
|
class AuthService(object):
|
||||||
|
"""Auth service."""
|
||||||
|
|
||||||
|
@providers.override(AuthService)
|
||||||
|
@providers.Factory
|
||||||
|
class ExtAuthService(AuthService.cls):
|
||||||
|
"""Extended auth service."""
|
||||||
|
|
||||||
|
auth_service = AuthService()
|
||||||
|
|
||||||
|
self.assertIsInstance(auth_service, ExtAuthService.cls)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user