Exemplo n.º 1
0
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())
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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())
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
def test_get_ssh_backup_dir():
    assert config.get_ssh_backup_dir() == path.join(config.get_macprefs_dir(),
                                                    'ssh/')
Exemplo n.º 6
0
def test_backup(copy_dir_mock):
    ssh_files.backup()
    copy_dir_mock.assert_called_with(get_ssh_user_dir(), get_ssh_backup_dir())