Beispiel #1
0
def test_share_backup_cli(mock_get_destination, mock_print):
    mock_config = mock.Mock()
    mock_config.get.return_value = "/foo/bar"
    mock_dst = mock.Mock()
    mock_dst.remote_path = '/foo/bar'
    mock_get_destination.return_value = mock_dst
    mock_dst.find_files.return_value = ["/foo/bar1", "/foo/bar"]
    share(mock_config, "/foo/bar")
    mock_print.assert_called_once()
    mock_dst.share.assert_called_once_with("/foo/bar")
    mock_get_destination.assert_called_once_with(mock_config)
Beispiel #2
0
def share_backup(ctx, s3_url):
    """Share backup copy for download"""
    if not s3_url:
        LOG.info('No backup copy specified. Choose one from below:')
        list_available_backups(ctx.obj['twindb_config'])
        exit(1)
    try:
        share(ctx.obj['twindb_config'], s3_url)
    except TwinDBBackupError as err:
        LOG.error(err)
        exit(1)
Beispiel #3
0
def share_backup(ctx, s3_url):
    """Share backup copy for download"""
    if not s3_url:
        LOG.info('No backup copy specified. Choose one from below:')
        list_available_backups(ctx.obj['twindb_config'])
        exit(1)
    try:
        share(ctx.obj['twindb_config'], s3_url)
    except TwinDBBackupError as err:
        LOG.error(err)
        exit(1)
Beispiel #4
0
def test_share_backup_cli(mock_print):
    mock_config = mock.Mock()
    mock_config.get.return_value = "/foo/bar"
    mock_dst = mock.Mock()
    mock_dst.remote_path = '/foo/bar'
    mock_config.destination.return_value = mock_dst
    mock_dst.find_files.return_value = ["/foo/bar1", "/foo/bar"]

    share(mock_config, "/foo/bar")

    mock_print.assert_called_once()
    mock_dst.share.assert_called_once_with("/foo/bar")
    mock_config.destination.assert_called_once_with()