def test_get_pm_path(exists_mock):
    exists_mock.return_value = False
    result = system_preferences.get_pm_path()
    assert 'SystemConfiguration' in result
def test_backup(copy_dir_mock):
    source = system_preferences.get_pm_path()
    dest = system_preferences.get_pm_backup_path()
    system_preferences.backup()
    copy_dir_mock.assert_called_with(source, dest)
def test_restore(copy_dir_mock, ensure_mock):
    source = system_preferences.get_pm_backup_path()
    dest = system_preferences.get_pm_path()
    system_preferences.restore()
    copy_dir_mock.assert_called_with(source, dest, with_sudo=True)
    ensure_mock.assert_called_with('root:wheel', [dest], '644')