def test_persist_updated_tunable(): """ Tests loader.conf success """ with patch("salt.utils.files.fopen", mock_open()): assert (freebsd_sysctl.persist("vfs.usermount", 1, "/boot/loader.conf") == "Updated")
def test_persist_updated(): """ Tests sysctl.conf success """ cmd = { "pid": 1337, "retcode": 0, "stderr": "", "stdout": "vfs.usermount: 1 -> 1", } mock_cmd = MagicMock(return_value=cmd) with patch("salt.utils.files.fopen", mock_open()): with patch.dict( freebsd_sysctl.__salt__, {"cmd.run_all": mock_cmd}, ): assert freebsd_sysctl.persist("vfs.usermount", 1) == "Updated"