mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-28 20:44:01 +03:00
Add test for configuration provider
This commit is contained in:
parent
a868d0bb06
commit
e03729958d
|
@ -47,6 +47,19 @@ class ConfigTests(unittest.TestCase):
|
||||||
self.assertEqual(abc(), 1)
|
self.assertEqual(abc(), 1)
|
||||||
self.assertEqual(abd(), 2)
|
self.assertEqual(abd(), 2)
|
||||||
|
|
||||||
|
def test_providers_with_already_set_value(self):
|
||||||
|
self.config.update({'a': {'b': {'c': 1, 'd': 2}}})
|
||||||
|
|
||||||
|
a = self.config.a
|
||||||
|
ab = self.config.a.b
|
||||||
|
abc = self.config.a.b.c
|
||||||
|
abd = self.config.a.b.d
|
||||||
|
|
||||||
|
self.assertEqual(a(), {'b': {'c': 1, 'd': 2}})
|
||||||
|
self.assertEqual(ab(), {'c': 1, 'd': 2})
|
||||||
|
self.assertEqual(abc(), 1)
|
||||||
|
self.assertEqual(abd(), 2)
|
||||||
|
|
||||||
def test_value_of_undefined_option(self):
|
def test_value_of_undefined_option(self):
|
||||||
self.assertIsNone(self.config.a())
|
self.assertIsNone(self.config.a())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user