# Path: pysecure/log_config.py

# 
# Path: pysecure/easy.py
# def connect_ssh_with_cb(ssh_cb, user, host, auth_cb, allow_new=True, 
#                         verbosity=0):
#     """A "managed" SSH session. When the session is ready, we'll invoke the 
#     "ssh_cb" callback.
#     """
# 
#     with connect_ssh(user, host, auth_cb, allow_new=True, verbosity=0) as ssh:
#         ssh_cb(ssh)
# 
# def connect_sftp_with_cb(sftp_cb, *args, **kwargs):
#     """A "managed" SFTP session. When the SSH session and an additional SFTP 
#     session are ready, invoke the sftp_cb callback.
#     """
# 
#     with _connect_sftp(*args, **kwargs) as (ssh, sftp):
#         sftp_cb(ssh, sftp)
# 
# def get_key_auth_cb(key_filepath):
#     """This is just a convenience function for key-based login."""
# 
#     def auth_cb(ssh):
#         key = ssh_pki_import_privkey_file(key_filepath)
#         ssh.userauth_publickey(key)
# 
#     return auth_cb
# 
# def get_password_auth_cb(password):
#     """This is just a convenience function for password-based login."""
# 
#     def auth_cb(ssh):
#         ssh.userauth_password(password)
# 
#     return auth_cb
# 
# Path: pysecure/test/test_config.py



from pysecure import log_config
from pysecure.easy import connect_ssh_with_cb, connect_sftp_with_cb, \
                          get_key_auth_cb, get_password_auth_cb
from pysecure.test.test_config import user, host, key_filepath, verbosity

def connect_sftp_test(sftp_cb):
    print("Connecting SFTP with key: %s" % (key_filepath))
    auth_cb = get_key_auth_cb(key_filepath)
    connect_sftp_with_cb(sftp_cb, user, host, auth_cb, verbosity=verbosity)

def connect_ssh_test(ssh_cb):
    print("Connecting SSH with key: %s" % (key_filepath))
    auth_cb = get_key_auth_cb(key_filepath)

# Path: pysecure/log_config.py

# 
# Path: pysecure/easy.py
# def connect_ssh_with_cb(ssh_cb, user, host, auth_cb, allow_new=True, 
#                         verbosity=0):
#     """A "managed" SSH session. When the session is ready, we'll invoke the 
#     "ssh_cb" callback.
#     """
# 
#     with connect_ssh(user, host, auth_cb, allow_new=True, verbosity=0) as ssh:
#         ssh_cb(ssh)
# 
# def connect_sftp_with_cb(sftp_cb, *args, **kwargs):
#     """A "managed" SFTP session. When the SSH session and an additional SFTP 
#     session are ready, invoke the sftp_cb callback.
#     """
# 
#     with _connect_sftp(*args, **kwargs) as (ssh, sftp):
#         sftp_cb(ssh, sftp)
# 
# def get_key_auth_cb(key_filepath):
#     """This is just a convenience function for key-based login."""
# 
#     def auth_cb(ssh):
#         key = ssh_pki_import_privkey_file(key_filepath)
#         ssh.userauth_publickey(key)
# 
#     return auth_cb
# 
# def get_password_auth_cb(password):
#     """This is just a convenience function for password-based login."""
# 
#     def auth_cb(ssh):
#         ssh.userauth_password(password)
# 
#     return auth_cb
# 
# Path: pysecure/test/test_config.py



# Path: pysecure/test/test_base.py
from pysecure import log_config
from pysecure.easy import connect_ssh_with_cb, connect_sftp_with_cb, \
                          get_key_auth_cb, get_password_auth_cb
from pysecure.test.test_config import user, host, key_filepath, verbosity


def connect_sftp_test(sftp_cb):
    print("Connecting SFTP with key: %s" % (key_filepath))
    auth_cb = get_key_auth_cb(key_filepath)
    connect_sftp_with_cb(sftp_cb, user, host, auth_cb, verbosity=verbosity)

def connect_ssh_test(ssh_cb):
    print("Connecting SSH with key: %s" % (key_filepath))
    auth_cb = get_key_auth_cb(key_filepath)

    connect_ssh_with_cb(ssh_cb, user, host, auth_cb, verbosity=verbosity)