scitacean.testing.sftp.fixtures.sftp_connect_with_username_password#

scitacean.testing.sftp.fixtures.sftp_connect_with_username_password(sftp_access)[source]#

Fixture that returns a function to connect to the testing SFTP server.

Uses username+password from the test config.

Returns:

Callable[[str, int], SFTPClient] – A function to pass as the connect argument when constructing a scitacean.transfer.sftp.SFTPFileTransfer.

Examples

Explicitly connect to the test server:

def test_sftp(sftp_access,
              sftp_connect_with_username_password,
              sftp_fileserver):
    sftp = SFTPFileTransfer(host=sftp_access.host,
                            port=sftp_access.port,
                            connect=sftp_connect_with_username_password)
    with sftp.connect_for_download() as connection:
        # use connection