Skip to content

Commit 2ff66de

Browse files
author
Roland Hedberg
committed
Fixed some tests.
1 parent 19a608c commit 2ff66de

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

src/saml2/mdstore.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def parse(self, xmlstr):
200200
def load(self):
201201
self.parse(self.metadata)
202202

203-
def _service(self, entity_id, typ, service, binding=None):
203+
def service(self, entity_id, typ, service, binding=None):
204204
""" Get me all services with a specified
205205
entity ID and type, that supports the specified version of binding.
206206
@@ -212,7 +212,7 @@ def _service(self, entity_id, typ, service, binding=None):
212212
Or if no binding was specified a list of 2-tuples (binding, srv)
213213
"""
214214

215-
logger.debug("_service(%s, %s, %s, %s)" % (entity_id, typ, service,
215+
logger.debug("service(%s, %s, %s, %s)" % (entity_id, typ, service,
216216
binding))
217217
try:
218218
srvs = []
@@ -239,7 +239,7 @@ def _service(self, entity_id, typ, service, binding=None):
239239
res[srv["binding"]].append(srv)
240240
except KeyError:
241241
res[srv["binding"]] = [srv]
242-
logger.debug("_service => %s" % res)
242+
logger.debug("service => %s" % res)
243243
return res
244244

245245
def ext_service(self, entity_id, typ, service, binding):
@@ -272,7 +272,7 @@ def any(self, typ, service, binding=None):
272272
"""
273273
res = {}
274274
for ent in self.keys():
275-
bind = self._service(ent, typ, service, binding)
275+
bind = self.service(ent, typ, service, binding)
276276
if bind:
277277
res[ent] = bind
278278

@@ -287,7 +287,7 @@ def bindings(self, entity_id, typ, service):
287287
:return:
288288
"""
289289

290-
return self._service(entity_id, typ, service)
290+
return self.service(entity_id, typ, service)
291291

292292
def attribute_requirement(self, entity_id, index=0):
293293
""" Returns what attributes the SP requires and which are optional
@@ -553,10 +553,10 @@ def imp(self, spec):
553553
else:
554554
self.load(key, val)
555555

556-
def _service(self, entity_id, typ, service, binding=None):
556+
def service(self, entity_id, typ, service, binding=None):
557557
known_principal = False
558558
for key, _md in self.metadata.items():
559-
srvs = _md._service(entity_id, typ, service, binding)
559+
srvs = _md.service(entity_id, typ, service, binding)
560560
if srvs:
561561
return srvs
562562
elif srvs is None:
@@ -592,37 +592,37 @@ def single_sign_on_service(self, entity_id, binding=None, typ="idpsso"):
592592

593593
if binding is None:
594594
binding = BINDING_HTTP_REDIRECT
595-
return self._service(entity_id, "idpsso_descriptor",
595+
return self.service(entity_id, "idpsso_descriptor",
596596
"single_sign_on_service", binding)
597597

598598
def name_id_mapping_service(self, entity_id, binding=None, typ="idpsso"):
599599
# IDP
600600
if binding is None:
601601
binding = BINDING_HTTP_REDIRECT
602-
return self._service(entity_id, "idpsso_descriptor",
602+
return self.service(entity_id, "idpsso_descriptor",
603603
"name_id_mapping_service", binding)
604604

605605
def authn_query_service(self, entity_id, binding=None,
606606
typ="authn_authority"):
607607
# AuthnAuthority
608608
if binding is None:
609609
binding = BINDING_SOAP
610-
return self._service(entity_id, "authn_authority_descriptor",
610+
return self.service(entity_id, "authn_authority_descriptor",
611611
"authn_query_service", binding)
612612

613613
def attribute_service(self, entity_id, binding=None,
614614
typ="attribute_authority"):
615615
# AttributeAuthority
616616
if binding is None:
617617
binding = BINDING_HTTP_REDIRECT
618-
return self._service(entity_id, "attribute_authority_descriptor",
618+
return self.service(entity_id, "attribute_authority_descriptor",
619619
"attribute_service", binding)
620620

621621
def authz_service(self, entity_id, binding=None, typ="pdp"):
622622
# PDP
623623
if binding is None:
624624
binding = BINDING_SOAP
625-
return self._service(entity_id, "pdp_descriptor",
625+
return self.service(entity_id, "pdp_descriptor",
626626
"authz_service", binding)
627627

628628
def assertion_id_request_service(self, entity_id, binding=None, typ=None):
@@ -631,7 +631,7 @@ def assertion_id_request_service(self, entity_id, binding=None, typ=None):
631631
raise AttributeError("Missing type specification")
632632
if binding is None:
633633
binding = BINDING_SOAP
634-
return self._service(entity_id, "%s_descriptor" % typ,
634+
return self.service(entity_id, "%s_descriptor" % typ,
635635
"assertion_id_request_service", binding)
636636

637637
def single_logout_service(self, entity_id, binding=None, typ=None):
@@ -640,35 +640,35 @@ def single_logout_service(self, entity_id, binding=None, typ=None):
640640
raise AttributeError("Missing type specification")
641641
if binding is None:
642642
binding = BINDING_HTTP_REDIRECT
643-
return self._service(entity_id, "%s_descriptor" % typ,
643+
return self.service(entity_id, "%s_descriptor" % typ,
644644
"single_logout_service", binding)
645645

646646
def manage_name_id_service(self, entity_id, binding=None, typ=None):
647647
# IDP + SP
648648
if binding is None:
649649
binding = BINDING_HTTP_REDIRECT
650-
return self._service(entity_id, "%s_descriptor" % typ,
650+
return self.service(entity_id, "%s_descriptor" % typ,
651651
"manage_name_id_service", binding)
652652

653653
def artifact_resolution_service(self, entity_id, binding=None, typ=None):
654654
# IDP + SP
655655
if binding is None:
656656
binding = BINDING_HTTP_REDIRECT
657-
return self._service(entity_id, "%s_descriptor" % typ,
657+
return self.service(entity_id, "%s_descriptor" % typ,
658658
"artifact_resolution_service", binding)
659659

660660
def assertion_consumer_service(self, entity_id, binding=None, _="spsso"):
661661
# SP
662662
if binding is None:
663663
binding = BINDING_HTTP_POST
664-
return self._service(entity_id, "spsso_descriptor",
664+
return self.service(entity_id, "spsso_descriptor",
665665
"assertion_consumer_service", binding)
666666

667667
def attribute_consuming_service(self, entity_id, binding=None, _="spsso"):
668668
# SP
669669
if binding is None:
670670
binding = BINDING_HTTP_REDIRECT
671-
return self._service(entity_id, "spsso_descriptor",
671+
return self.service(entity_id, "spsso_descriptor",
672672
"attribute_consuming_service", binding)
673673

674674
def discovery_response(self, entity_id, binding=None, _="spsso"):

tests/test_80_p11_backend.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,7 @@ def test_xmlsec_cryptobackend():
213213
t = TestPKCS11()
214214
t.setup_class()
215215
t.test_SAML_sign_with_pkcs11()
216+
217+
218+
if __name__ == "__main__":
219+
test_xmlsec_cryptobackend()

tests/test_81_certificates.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ def test_validate_with_root_cert(self):
3030

3131
osw = OpenSSLWrapper()
3232

33-
ca_cert, ca_key = osw.create_certificate(cert_info_ca, request=False, write_to_file=True,
34-
cert_dir="/Users/haho0032/Develop/openSSL/pki")
33+
ca_cert, ca_key = osw.create_certificate(cert_info_ca, request=False,
34+
write_to_file=True,
35+
cert_dir="pki")
3536

3637
req_cert_str, req_key_str = osw.create_certificate(cert_info, request=True)
3738

0 commit comments

Comments
 (0)