aboutsummaryrefslogtreecommitdiffstats
path: root/src/python/tests
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2021-03-26 13:50:01 +0000
committerGerrit Code Review <gerrit@onap.org>2021-03-26 13:50:01 +0000
commit0c3c63ccbe28a18f57b8341a73eca08a6ad832fc (patch)
tree72facd7c3dbeddf0569caf61650ae71a062849c0 /src/python/tests
parent1bf3fbc3d6f98cb18f009b2a12ca9d35436265c8 (diff)
parent480e3de63f475477138c45f551def992ba8d8b9d (diff)
Merge "Add endopint for config change"
Diffstat (limited to 'src/python/tests')
-rw-r--r--src/python/tests/netconf_server/sysrepo_configuration/test_sysrepo_configuration_manager_.py31
-rw-r--r--src/python/tests/netconf_server/test_netconf_chang_listener.py (renamed from src/python/tests/netconf_server/test_netconf_server.py)0
2 files changed, 31 insertions, 0 deletions
diff --git a/src/python/tests/netconf_server/sysrepo_configuration/test_sysrepo_configuration_manager_.py b/src/python/tests/netconf_server/sysrepo_configuration/test_sysrepo_configuration_manager_.py
new file mode 100644
index 0000000..5194218
--- /dev/null
+++ b/src/python/tests/netconf_server/sysrepo_configuration/test_sysrepo_configuration_manager_.py
@@ -0,0 +1,31 @@
+import unittest
+from unittest.mock import MagicMock
+from netconf_server.sysrepo_configuration.sysrepo_configuration_manager import SysrepoConfigurationManager
+
+
+class TestSysrepoConfigurationManager(unittest.TestCase):
+
+ def test_should_change_configuration(self):
+ # given
+ expected_parse_data = "parse_data"
+
+ ctx = MagicMock()
+ ctx.parse_data_mem = MagicMock(return_value=expected_parse_data)
+ connection = MagicMock()
+ connection.get_ly_ctx = MagicMock(return_value=ctx)
+ session = MagicMock()
+ session.replace_config_ly = MagicMock()
+
+ config_data = '''<config xmlns="http://onap.org/pnf-simulator">
+ <itemValue1>12</itemValue1>
+ <itemValue2>12</itemValue2>
+ </config>'''
+ module_name = "pnf-simulator"
+
+ # when
+ config_manager = SysrepoConfigurationManager(session=session, connection=connection)
+ config_manager.change_configuration(config_data=config_data, module_name=module_name)
+
+ # then
+ ctx.parse_data_mem.assert_called_with(config_data, "xml", config=True, strict=False)
+ session.replace_config_ly.assert_called_with(expected_parse_data, module_name)
diff --git a/src/python/tests/netconf_server/test_netconf_server.py b/src/python/tests/netconf_server/test_netconf_chang_listener.py
index c2889f1..c2889f1 100644
--- a/src/python/tests/netconf_server/test_netconf_server.py
+++ b/src/python/tests/netconf_server/test_netconf_chang_listener.py