From e03729958df3e1ae248f5b13b9f7f843cca648e0 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Fri, 2 Dec 2016 19:29:17 +0200 Subject: [PATCH] Add test for configuration provider --- tests/unit/providers/test_configuration.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/unit/providers/test_configuration.py b/tests/unit/providers/test_configuration.py index c2d302eb..3e116ee0 100644 --- a/tests/unit/providers/test_configuration.py +++ b/tests/unit/providers/test_configuration.py @@ -47,6 +47,19 @@ class ConfigTests(unittest.TestCase): self.assertEqual(abc(), 1) 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): self.assertIsNone(self.config.a())