Skip to content

Commit 1fa9150

Browse files
committed
add UT
1 parent 2929d01 commit 1fa9150

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/generic_config_updater/gu_common_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ def setUp(self):
5757
self.config_wrapper_mock = gu_common.ConfigWrapper()
5858
self.config_wrapper_mock.get_config_db_as_json=MagicMock(return_value=Files.CONFIG_DB_AS_JSON)
5959

60+
def test_validate_field_operation_legal(self):
61+
old_config = {"PFC_WD": {"GLOBAL": {"POLL_INTERVAL": "60"}}}
62+
target_config = {"PFC_WD": {"GLOBAL": {"POLL_INTERVAL": "40"}}}
63+
config_wrapper = gu_common.ConfigWrapper()
64+
config_wrapper.validate_field_operation(old_config, target_config)
65+
66+
def test_validate_field_operation_illegal(self):
67+
old_config = {"PFC_WD": {"GLOBAL": {"POLL_INTERVAL": 60}}}
68+
target_config = {"PFC_WD": {"GLOBAL": {}}}
69+
config_wrapper = gu_common.ConfigWrapper()
70+
self.assertRaises(gu_common.IllegalPatchOperationError, config_wrapper.validate_field_operation, old_config, target_config)
71+
6072
def test_ctor__default_values_set(self):
6173
config_wrapper = gu_common.ConfigWrapper()
6274

0 commit comments

Comments
 (0)