From 24215d33e5c3596000111113c6f70673506665cd Mon Sep 17 00:00:00 2001 From: jihaix Date: Thu, 16 May 2019 17:29:46 +0800 Subject: [PATCH] Add a unit-test in sonic-cfggen to test argument "--var-json" --- src/sonic-config-engine/tests/test_cfggen.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index a841f4d19c23..5a6c0f62ce26 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -65,6 +65,11 @@ def test_additional_json_data(self): output = self.run_script(argument) self.assertEqual(output.strip(), 'value1') + def test_var_json_data(self): + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" --var-json VLAN_MEMBER' + output = self.run_script(argument) + self.assertEqual(output.strip(), '{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "untagged"\n }\n}') + def test_read_yaml(self): argument = '-v yml_item -y ' + os.path.join(self.test_dir, 'test.yml') output = self.run_script(argument)