From ddb26a9f42bee900bbd53027970ed8c906765df9 Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Mon, 16 Mar 2026 17:19:14 -0400 Subject: [PATCH] Add test for raw dict output in so-yaml get to reach 100% coverage Covers the dict/list branch in raw mode (line 358) that was missing test coverage. --- salt/manager/tools/sbin/so-yaml_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/salt/manager/tools/sbin/so-yaml_test.py b/salt/manager/tools/sbin/so-yaml_test.py index 6797003b3..2da8a0be9 100644 --- a/salt/manager/tools/sbin/so-yaml_test.py +++ b/salt/manager/tools/sbin/so-yaml_test.py @@ -450,6 +450,18 @@ class TestRemove(unittest.TestCase): self.assertEqual(result, 0) self.assertEqual("false\n", mock_stdout.getvalue()) + def test_get_dict_raw(self): + with patch('sys.stdout', new=StringIO()) as mock_stdout: + filename = "/tmp/so-yaml_test-get.yaml" + file = open(filename, "w") + file.write("{key1: { child1: 123, child2: { deep1: 45 } }, key2: false, key3: [e,f,g]}") + file.close() + + result = soyaml.get(["-r", filename, "key1"]) + self.assertEqual(result, 0) + self.assertIn("child1: 123", mock_stdout.getvalue()) + self.assertNotIn("...", mock_stdout.getvalue()) + def test_get_list(self): with patch('sys.stdout', new=StringIO()) as mock_stdout: filename = "/tmp/so-yaml_test-get.yaml"