Example #1
0
def test_delval_nested():
    with patch.dict(
        grainsmod.__grains__, {"a": "aval", "b": {"nested": "val"}, "c": 8}
    ):
        res = grainsmod.delval("b:nested")
        assert res["result"]
        assert res["changes"] == {"b": {"nested": None}}
        assert grainsmod.__grains__ == {"a": "aval", "b": {"nested": None}, "c": 8}
Example #2
0
 def test_delval_nested(self):
     with patch.dict(
         grainsmod.__grains__, {"a": "aval", "b": {"nested": "val"}, "c": 8}
     ):
         res = grainsmod.delval("b:nested")
         self.assertTrue(res["result"])
         self.assertEqual(res["changes"], {"b": {"nested": None}})
         self.assertEqual(
             grainsmod.__grains__, {"a": "aval", "b": {"nested": None}, "c": 8}
         )