diff options
author | Anselm Kruis <Anselm.Kruis@atos.net> | 2018-10-05 18:15:24 +0200 |
---|---|---|
committer | Anselm Kruis <Anselm.Kruis@atos.net> | 2018-10-05 18:58:52 +0200 |
commit | a36499fd8762a19da43ee16429b148cb89f4d39f (patch) | |
tree | 7243ba5466d9dfadd25443820e1cd8f3f4587fa5 /tests/test_ssh_gss.py | |
parent | db358dc149f7549c147e520bbe5c26b571d899d4 (diff) |
Use k5test (if available) to execute GSSAPI related tests
Previously testing of GSSAPI (Kerberos) related functions required an
externally provided Kerberos environment. Therefore all GSSAPI tests were
skipped.
Now the package k5test is used to setup a self-contained Kerberos environment.
Because k5test requires the new GSSAPI, this commit also merges
pull request #1166 and fixes broken GSSAPI test. If k5test is not available
(i.e. on Windows), the tests still get skipped.
The test case test_kex_gss.test_2_gsskex_and_auth_rekey is expected to fail.
Diffstat (limited to 'tests/test_ssh_gss.py')
-rw-r--r-- | tests/test_ssh_gss.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/test_ssh_gss.py b/tests/test_ssh_gss.py index b6b50152..d326f522 100644 --- a/tests/test_ssh_gss.py +++ b/tests/test_ssh_gss.py @@ -25,11 +25,10 @@ Unit Tests for the GSS-API / SSPI SSHv2 Authentication (gssapi-with-mic) import socket import threading -import unittest import paramiko -from .util import _support, needs_gssapi +from .util import _support, needs_gssapi, KerberosTestCase, update_env from .test_client import FINGERPRINTS @@ -67,17 +66,18 @@ class NullServer(paramiko.ServerInterface): @needs_gssapi -class GSSAuthTest(unittest.TestCase): +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 = "krb5_principal" - self.hostname = socket.getfqdn("targ_name") + self.username = self.realm.user_princ + self.hostname = socket.getfqdn(self.realm.hostname) self.sockl = socket.socket() - self.sockl.bind(("targ_name", 0)) + 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) thread = threading.Thread(target=self._run) thread.start() @@ -148,7 +148,8 @@ class GSSAuthTest(unittest.TestCase): def test_2_auth_trickledown(self): """ - Failed gssapi-with-mic auth doesn't prevent subsequent key auth from succeeding + Failed gssapi-with-mic auth doesn't prevent subsequent key auth from + succeeding """ self.hostname = ( "this_host_does_not_exists_and_causes_a_GSSAPI-exception" |