aboutsummaryrefslogtreecommitdiffstats
path: root/src/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/tests')
-rw-r--r--src/python/tests/unit/sysrepo_configuration/test_sysrepo_configuration_manager_.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/python/tests/unit/sysrepo_configuration/test_sysrepo_configuration_manager_.py b/src/python/tests/unit/sysrepo_configuration/test_sysrepo_configuration_manager_.py
index 5194218..6c83f5f 100644
--- a/src/python/tests/unit/sysrepo_configuration/test_sysrepo_configuration_manager_.py
+++ b/src/python/tests/unit/sysrepo_configuration/test_sysrepo_configuration_manager_.py
@@ -1,3 +1,4 @@
+import json
import unittest
from unittest.mock import MagicMock
from netconf_server.sysrepo_configuration.sysrepo_configuration_manager import SysrepoConfigurationManager
@@ -29,3 +30,20 @@ class TestSysrepoConfigurationManager(unittest.TestCase):
# 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)
+
+ def test_should_get_configuration(self):
+ # given
+ expected_parse_data = '{"config": {"itemValue1": 42,"itemValue2": 35}}'
+
+ connection = MagicMock()
+ session = MagicMock()
+ session.get_data = MagicMock(return_value=expected_parse_data)
+ module_name = "pnf-simulator"
+
+ # when
+ config_manager = SysrepoConfigurationManager(session=session, connection=connection)
+ data = config_manager.get_configuration(module_name=module_name)
+
+ # then
+ session.get_data.assert_called_with("/" + module_name + ":*")
+ self.assertEqual(data, json.dumps(expected_parse_data))