summaryrefslogtreecommitdiffhomepage
path: root/tests/test_ssh_gss.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-10-23 11:31:03 -0700
committerJeff Forcier <jeff@bitprophet.org>2018-09-17 14:15:32 -0700
commit6a4233be4bcddf480dd3d5ef96cdc8f39ad16795 (patch)
tree71471d725b6ad0d95361bb8dece58781374c0372 /tests/test_ssh_gss.py
parent6b96afd1d32316b0be3c28d3b5d298493086de27 (diff)
Import cleanup, mostly focused on s/tests/./
Diffstat (limited to 'tests/test_ssh_gss.py')
-rw-r--r--tests/test_ssh_gss.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/test_ssh_gss.py b/tests/test_ssh_gss.py
index 081d942b..f0645e0e 100644
--- a/tests/test_ssh_gss.py
+++ b/tests/test_ssh_gss.py
@@ -29,17 +29,20 @@ import unittest
import paramiko
-from tests.util import _support
-from tests.test_client import FINGERPRINTS
+from .util import _support, needs_gssapi
+from .test_client import FINGERPRINTS
-class NullServer (paramiko.ServerInterface):
+class NullServer (paramiko.ServerInterface):
def get_allowed_auths(self, username):
return 'gssapi-with-mic,publickey'
- def check_auth_gssapi_with_mic(self, username,
- gss_authenticated=paramiko.AUTH_FAILED,
- cc_file=None):
+ def check_auth_gssapi_with_mic(
+ self,
+ username,
+ gss_authenticated=paramiko.AUTH_FAILED,
+ cc_file=None,
+ ):
if gss_authenticated == paramiko.AUTH_SUCCESSFUL:
return paramiko.AUTH_SUCCESSFUL
return paramiko.AUTH_FAILED
@@ -66,18 +69,15 @@ class NullServer (paramiko.ServerInterface):
return True
+@needs_gssapi
class GSSAuthTest(unittest.TestCase):
- @staticmethod
- def init(username, hostname):
- global krb5_principal, targ_name
- krb5_principal = username
- targ_name = hostname
-
def setUp(self):
- self.username = krb5_principal
- self.hostname = socket.getfqdn(targ_name)
+ # TODO: username and targ_name should come from os.environ or whatever
+ # the approved pytest method is for runtime-configuring test data.
+ self.username = "krb5_principal"
+ self.hostname = socket.getfqdn("targ_name")
self.sockl = socket.socket()
- self.sockl.bind((targ_name, 0))
+ self.sockl.bind(("targ_name", 0))
self.sockl.listen(1)
self.addr, self.port = self.sockl.getsockname()
self.event = threading.Event()