|
3 | 3 | import unittest |
4 | 4 |
|
5 | 5 | from pyms.config.conf import Config |
6 | | - |
7 | 6 | from pyms.config.confile import ConfFile |
8 | 7 | from pyms.constants import CONFIGMAP_FILE_ENVIRONMENT, LOGGER_NAME |
9 | 8 | from pyms.exceptions import AttrDoesNotExistException, ConfigDoesNotFoundException, ServiceDoesNotExistException |
@@ -48,6 +47,26 @@ def test_dictionary_recursive_dict_normal_key_dinamyc(self): |
48 | 47 | config = ConfFile(config={"test-1": {"test-1-1": "a", "test_1-2": "b"}, "test_2": "c"}) |
49 | 48 | self.assertEqual(getattr(config, "test_1.test_1_2"), "b") |
50 | 49 |
|
| 50 | + def test_equal_instances_error(self): |
| 51 | + config1 = ConfFile(config={"test-1": {"test-1-1": "a", "test_1-2": "b"}, "test_2": "c"}) |
| 52 | + config2 = ConfFile(config={"test-1": {"test-1-1": "a", "test_1-2": "b"}}) |
| 53 | + self.assertNotEqual(config1, config2) |
| 54 | + |
| 55 | + def test_equal_instances_error2(self): |
| 56 | + config1 = ConfFile(config={"test-1": {"test-1-1": "a", "test_1-2": "b"}}) |
| 57 | + config2 = {"test-1": {"test-1-1": "a", "test-1-2": "b"}} |
| 58 | + self.assertNotEqual(config1, config2) |
| 59 | + |
| 60 | + def test_equal_instances_ok(self): |
| 61 | + config1 = ConfFile(config={"test-1": {"test-1-1": "a", "test_1-2": "b"}}) |
| 62 | + config2 = ConfFile(config={"test-1": {"test-1-1": "a", "test_1-2": "b"}}) |
| 63 | + self.assertEqual(config1, config2) |
| 64 | + |
| 65 | + def test_equal_instances_ok2(self): |
| 66 | + config1 = ConfFile(config={"test-1": {"test-1-1": "a", "test_1-2": "b"}}) |
| 67 | + config2 = {"test_1": {"test_1_1": "a", "test_1_2": "b"}} |
| 68 | + self.assertEqual(config1, config2) |
| 69 | + |
51 | 70 | def test_dictionary_attribute_not_exists(self): |
52 | 71 | config = ConfFile(config={"test-1": "a"}) |
53 | 72 | with self.assertRaises(AttrDoesNotExistException): |
@@ -98,3 +117,7 @@ def test_empty_conf_two_levels(self): |
98 | 117 | def test_empty_conf_three_levels(self): |
99 | 118 | config = ConfFile(empty_init=True) |
100 | 119 | self.assertEqual(config.my_ms.level_two.level_three, {}) |
| 120 | + |
| 121 | + |
| 122 | +if __name__ == '__main__': |
| 123 | + unittest.main() |
0 commit comments