From 37fde8e97c1dd4d99e74c44f891f3ebf30ee6197 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Tue, 1 Mar 2016 16:28:37 +0200 Subject: [PATCH] Add tests for @providers.override decorator --- tests/test_providers.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_providers.py b/tests/test_providers.py index 93fabcae..b5aca482 100644 --- a/tests/test_providers.py +++ b/tests/test_providers.py @@ -1113,3 +1113,18 @@ class FactoryAsDecoratorTests(unittest.TestCase): self.assertIsInstance(users_service, UsersService.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)