# Path: tests/util.py
# def _support(filename):
# def _config(name):
# def needs_builtin(name):
#         def __init__(self):
#         def setUpClass(cls):
#         def tearDownClass(cls):
#             def setUpClass(cls):
# def update_env(testcase, mapping, env=os.environ):
#     def replace(target, source):
# def k5shell(args=None):
# def is_low_entropy():
#     class DummyK5Realm(object):
#     class KerberosTestCase(unittest.TestCase):
#         class KerberosTestCase(unittest.TestCase):
# 
# Path: tests/test_client.py
# FINGERPRINTS = {
#     "ssh-dss": b"\x44\x78\xf0\xb9\xa2\x3c\xc5\x18\x20\x09\xff\x75\x5b\xc1\xd2\x6c",  # noqa
#     "ssh-rsa": b"\x60\x73\x38\x44\xcb\x51\x86\x65\x7f\xde\xda\xa2\x2b\x5a\x57\xd5",  # noqa
#     "ecdsa-sha2-nistp256": b"\x25\x19\xeb\x55\xe6\xa1\x47\xff\x4f\x38\xd2\x75\x6f\xa5\xd5\x60",  # noqa
#     "ssh-ed25519": b'\xb3\xd5"\xaa\xf9u^\xe8\xcd\x0e\xea\x02\xb9)\xa2\x80',
# }


import socket
import threading
import paramiko
from .util import _support, needs_gssapi, KerberosTestCase, update_env
from .test_client import FINGERPRINTS
        try:
            expected = FINGERPRINTS[key.get_name()]
        except KeyError:
            return paramiko.AUTH_FAILED
        else:
            if key.get_fingerprint() == expected:
                return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED

    def check_channel_request(self, kind, chanid):
        return paramiko.OPEN_SUCCEEDED

    def check_channel_exec_request(self, channel, command):
        if command != b"yes":
            return False
        return True


@needs_gssapi
class GSSAuthTest(KerberosTestCase):
    def setUp(self):
        # TODO: username and targ_name should come from os.environ or whatever
        # the approved pytest method is for runtime-configuring test data.
        self.username = self.realm.user_princ
        self.hostname = socket.getfqdn(self.realm.hostname)
        self.sockl = socket.socket()
        self.sockl.bind((self.realm.hostname, 0))
        self.sockl.listen(1)
        self.addr, self.port = self.sockl.getsockname()
        self.event = threading.Event()

# Path: tests/util.py
# def _support(filename):
# def _config(name):
# def needs_builtin(name):
#         def __init__(self):
#         def setUpClass(cls):
#         def tearDownClass(cls):
#             def setUpClass(cls):
# def update_env(testcase, mapping, env=os.environ):
#     def replace(target, source):
# def k5shell(args=None):
# def is_low_entropy():
#     class DummyK5Realm(object):
#     class KerberosTestCase(unittest.TestCase):
#         class KerberosTestCase(unittest.TestCase):
# 
# Path: tests/test_client.py
# FINGERPRINTS = {
#     "ssh-dss": b"\x44\x78\xf0\xb9\xa2\x3c\xc5\x18\x20\x09\xff\x75\x5b\xc1\xd2\x6c",  # noqa
#     "ssh-rsa": b"\x60\x73\x38\x44\xcb\x51\x86\x65\x7f\xde\xda\xa2\x2b\x5a\x57\xd5",  # noqa
#     "ecdsa-sha2-nistp256": b"\x25\x19\xeb\x55\xe6\xa1\x47\xff\x4f\x38\xd2\x75\x6f\xa5\xd5\x60",  # noqa
#     "ssh-ed25519": b'\xb3\xd5"\xaa\xf9u^\xe8\xcd\x0e\xea\x02\xb9)\xa2\x80',
# }


# Path: tests/test_ssh_gss.py
import socket
import threading
import paramiko
from .util import _support, needs_gssapi, KerberosTestCase, update_env
from .test_client import FINGERPRINTS

        try:
            expected = FINGERPRINTS[key.get_name()]
        except KeyError:
            return paramiko.AUTH_FAILED
        else:
            if key.get_fingerprint() == expected:
                return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED

    def check_channel_request(self, kind, chanid):
        return paramiko.OPEN_SUCCEEDED

    def check_channel_exec_request(self, channel, command):
        if command != b"yes":
            return False
        return True


@needs_gssapi
class GSSAuthTest(KerberosTestCase):
    def setUp(self):
        # TODO: username and targ_name should come from os.environ or whatever
        # the approved pytest method is for runtime-configuring test data.
        self.username = self.realm.user_princ
        self.hostname = socket.getfqdn(self.realm.hostname)
        self.sockl = socket.socket()
        self.sockl.bind((self.realm.hostname, 0))
        self.sockl.listen(1)
        self.addr, self.port = self.sockl.getsockname()
        self.event = threading.Event()

        update_env(self, self.realm.env)