Esempio n. 1
0
def test_table_to_sftp_csv_no_password(live_sftp, simple_table, compression):
    host = os.environ.get('SFTP_HOST')
    username = os.environ.get('SFTP_USERNAME')
    rsa_private_key_file = os.environ.get('SFTP_RSA_PRIVATE_KEY_FILE')

    remote_path = f'{REMOTE_DIR}/test_to_sftp.csv'
    if compression == 'gzip':
        remote_path += '.gz'

    simple_table.to_sftp_csv(remote_path, host, username, None, rsa_private_key_file=rsa_private_key_file, compression=compression)

    local_path = live_sftp.get_file(remote_path)
    assert_file_matches_table(local_path, simple_table)

    # Cleanup
    live_sftp.remove_file(remote_path)
Esempio n. 2
0
def test_table_to_sftp_csv(live_sftp, simple_table, compression):
    host = os.environ['SFTP_HOST']
    username = os.environ['SFTP_USERNAME']
    password = os.environ['SFTP_PASSWORD']
    remote_path = f'{REMOTE_DIR}/test_to_sftp.csv'
    if compression == 'gzip':
        remote_path += '.gz'
    simple_table.to_sftp_csv(remote_path,
                             host,
                             username,
                             password,
                             compression=compression)

    local_path = live_sftp.get_file(remote_path)
    assert_file_matches_table(local_path, simple_table)

    # Cleanup
    live_sftp.remove_file(remote_path)