def live_sftp(simple_table, simple_csv_path, simple_compressed_csv_path): # noqa: F811 # Generate a live SFTP connection based on these env vars host = os.environ['SFTP_HOST'] username = os.environ['SFTP_USERNAME'] password = None rsa_private_key_file = os.environ['SFTP_RSA_PRIVATE_KEY_FILE'] sftp = SFTP(host, username, password, rsa_private_key_file=rsa_private_key_file) # Add a test directory and test files sftp.make_directory(REMOTE_DIR) sftp.put_file(simple_csv_path, REMOTE_CSV_PATH) sftp.put_file(simple_compressed_csv_path, REMOTE_COMPRESSED_CSV_PATH) yield sftp # Cleanup after test sftp.remove_file(REMOTE_CSV_PATH) sftp.remove_file(REMOTE_COMPRESSED_CSV_PATH) sftp.remove_directory(REMOTE_DIR)
def live_sftp(simple_table, simple_csv_path, simple_compressed_csv_path): # Generate a live SFTP connection based on these env vars host = os.environ['SFTP_HOST'] username = os.environ['SFTP_USERNAME'] password = os.environ['SFTP_PASSWORD'] sftp = SFTP(host, username, password) # Add a test directory and test files sftp.make_directory(REMOTE_DIR) sftp.put_file(simple_csv_path, REMOTE_CSV_PATH) sftp.put_file(simple_compressed_csv_path, REMOTE_COMPRESSED_CSV_PATH) yield sftp # Cleanup after test sftp.remove_file(REMOTE_CSV_PATH) sftp.remove_file(REMOTE_COMPRESSED_CSV_PATH) sftp.remove_directory(REMOTE_DIR)