summaryrefslogtreecommitdiffhomepage
path: root/tests/test_gssapi.py
diff options
context:
space:
mode:
authorAnselm Kruis <Anselm.Kruis@atos.net>2018-10-05 19:30:48 +0200
committerAnselm Kruis <Anselm.Kruis@atos.net>2018-10-05 19:30:48 +0200
commita8e8f9aa89c2c1fe65e4477d8d553eb5e669c927 (patch)
tree59ab024b836c354492351e1cb14d9e9bb2a38eb9 /tests/test_gssapi.py
parenta36499fd8762a19da43ee16429b148cb89f4d39f (diff)
Reformatted as proposed by travis.blacken
Diffstat (limited to 'tests/test_gssapi.py')
-rw-r--r--tests/test_gssapi.py43
1 files changed, 27 insertions, 16 deletions
diff --git a/tests/test_gssapi.py b/tests/test_gssapi.py
index 98d4d14e..8e6ec37a 100644
--- a/tests/test_gssapi.py
+++ b/tests/test_gssapi.py
@@ -53,8 +53,11 @@ class GSSAPITest(KerberosTestCase):
"""
try:
import gssapi
- if (hasattr(gssapi, '__title__') and
- gssapi.__title__ == 'python-gssapi'):
+
+ if (
+ hasattr(gssapi, "__title__")
+ and gssapi.__title__ == "python-gssapi"
+ ):
_API = "PYTHON-GSSAPI-OLD"
else:
_API = "PYTHON-GSSAPI-NEW"
@@ -118,28 +121,36 @@ class GSSAPITest(KerberosTestCase):
self.assertEquals(0, status)
elif _API == "PYTHON-GSSAPI-NEW":
if self.server_mode:
- gss_flags = (gssapi.RequirementFlag.protection_ready,
- gssapi.RequirementFlag.integrity,
- gssapi.RequirementFlag.mutual_authentication,
- gssapi.RequirementFlag.delegate_to_peer)
+ gss_flags = (
+ gssapi.RequirementFlag.protection_ready,
+ gssapi.RequirementFlag.integrity,
+ gssapi.RequirementFlag.mutual_authentication,
+ gssapi.RequirementFlag.delegate_to_peer,
+ )
else:
- gss_flags = (gssapi.RequirementFlag.protection_ready,
- gssapi.RequirementFlag.integrity,
- gssapi.RequirementFlag.delegate_to_peer)
+ gss_flags = (
+ gssapi.RequirementFlag.protection_ready,
+ gssapi.RequirementFlag.integrity,
+ gssapi.RequirementFlag.delegate_to_peer,
+ )
# Initialize a GSS-API context.
krb5_oid = gssapi.MechType.kerberos
- target_name = gssapi.Name("host@" + self.targ_name,
- name_type=gssapi.NameType.hostbased_service)
- gss_ctxt = gssapi.SecurityContext(name=target_name,
- flags=gss_flags,
- mech=krb5_oid,
- usage='initiate')
+ target_name = gssapi.Name(
+ "host@" + self.targ_name,
+ name_type=gssapi.NameType.hostbased_service,
+ )
+ gss_ctxt = gssapi.SecurityContext(
+ name=target_name,
+ flags=gss_flags,
+ mech=krb5_oid,
+ usage="initiate",
+ )
if self.server_mode:
c_token = gss_ctxt.step(c_token)
gss_ctxt_status = gss_ctxt.complete
self.assertEquals(False, gss_ctxt_status)
# Accept a GSS-API context.
- gss_srv_ctxt = gssapi.SecurityContext(usage='accept')
+ gss_srv_ctxt = gssapi.SecurityContext(usage="accept")
s_token = gss_srv_ctxt.step(c_token)
gss_ctxt_status = gss_srv_ctxt.complete
self.assertNotEquals(None, s_token)