def test_get_preferences_dir(): assert config.get_preferences_dir() == path.join(config.get_home_dir(), 'Library/Preferences/')
def test_backup(copy_dir_mock): source = get_preferences_dir() dest = get_preferences_backup_dir() preferences.backup() copy_dir_mock.assert_called_with(source, dest)
def test_restore(copy_dir_mock, ensure_mock): source = get_preferences_backup_dir() dest = get_preferences_dir() preferences.restore() copy_dir_mock.assert_called_with(source, dest, with_sudo=True) ensure_mock.assert_called_with(dest, get_user())
def backup(): print 'Backing up preferences (.plist)...' source = get_preferences_dir() dest = get_preferences_backup_dir() copy_dir(source, dest)
def restore(): print 'Restoring preferences (.plist)...' source = get_preferences_backup_dir() dest = get_preferences_dir() copy_dir(source, dest, with_sudo=True) ensure_dir_owned_by_user(dest, get_user())
def backup(): log.info('Backing up preferences (.plist)...') source = get_preferences_dir() dest = get_preferences_backup_dir() copy_dir(source, dest)