def test_restore(copy_dir_mock, ensure_mock): dest = get_ssh_user_dir() ssh_files.restore() copy_dir_mock.assert_called_with(get_ssh_backup_dir(), dest, with_sudo=True) ensure_mock.assert_called_with(dest, get_user())
def backup(): source = get_ssh_user_dir() if not exists(source): log.info('No .ssh dir found... skipping.') return log.info('Backing up .ssh dir...') dest = get_ssh_backup_dir() ensure_exists(dest) copy_dir(source, dest)
def restore(): source = get_ssh_backup_dir() if not exists(source): log.info('No .ssh dir found... skipping.') return log.info('Restoring .ssh dir...') dest = get_ssh_user_dir() copy_dir(source, dest, with_sudo=True) ensure_dir_owned_by_user(dest, get_user())
def backup(): source = get_ssh_user_dir() if not exists(source): print 'No .ssh dir found... skipping.' return print 'Backing up .ssh dir...' dest = get_ssh_backup_dir() ensure_exists(dest) copy_dir(source, dest)
def test_get_ssh_backup_dir(): assert config.get_ssh_backup_dir() == path.join(config.get_macprefs_dir(), 'ssh/')
def test_backup(copy_dir_mock): ssh_files.backup() copy_dir_mock.assert_called_with(get_ssh_user_dir(), get_ssh_backup_dir())