Fix bug in MetadataStore.extension().
Continue with the next metadata source if the entity id or the expected type (SP or IDP) SSO descriptor is not found in the current metadata source instead of prematurely returning.
This commit is contained in:
@@ -992,10 +992,7 @@ class MetadataStore(MetaData):
|
||||
try:
|
||||
srvs = _md[entity_id][typ]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
if not srvs:
|
||||
return srvs
|
||||
continue
|
||||
|
||||
res = []
|
||||
for srv in srvs:
|
||||
@@ -1005,6 +1002,8 @@ class MetadataStore(MetaData):
|
||||
res.append(elem)
|
||||
return res
|
||||
|
||||
return None
|
||||
|
||||
def ext_service(self, entity_id, typ, service, binding=None):
|
||||
known_entity = False
|
||||
for key, _md in self.metadata.items():
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
import re
|
||||
from collections import OrderedDict
|
||||
|
||||
from future.backports.urllib.parse import quote_plus
|
||||
|
||||
@@ -455,5 +456,16 @@ def test_metadata_extension_algsupport():
|
||||
mdf = mds.metadata[full_path("uu.xml")]
|
||||
assert mds
|
||||
|
||||
|
||||
def test_extension():
|
||||
mds = MetadataStore(ATTRCONV, None)
|
||||
# use ordered dict to force expected entity to be last
|
||||
metadata = OrderedDict()
|
||||
metadata["1"] = {"entity1": {}}
|
||||
metadata["2"] = {"entity2": {"idpsso_descriptor": [{"extensions": {"extension_elements": [{"__class__": "test"}]}}]}}
|
||||
mds.metadata = metadata
|
||||
assert mds.extension("entity2", "idpsso_descriptor", "test")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_metadata_extension_algsupport()
|
||||
|
||||
Reference in New Issue
Block a user