Skip to content

Commit 9a1974b

Browse files
author
Roland Hedberg
committed
Fixed a list construction.
Added equality method for metadata sources. Checks that they contain the same information or not.
1 parent 0326f9f commit 9a1974b

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/saml2/mdstore.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,26 @@ def entity_categories(self, entity_id):
345345

346346
return res
347347

348+
def __eq__(self, other):
349+
try:
350+
assert isinstance(other, MetaData)
351+
except AssertionError:
352+
return False
353+
354+
if len(self.entity) != len(other.entity):
355+
return False
356+
357+
if set(self.entity.keys()) != set(other.entity.keys()):
358+
return False
359+
360+
for key, item in self.entity.items():
361+
try:
362+
assert item == other[key]
363+
except AssertionError:
364+
return False
365+
366+
return True
367+
348368

349369
class MetaDataFile(MetaData):
350370
"""

src/saml2/server.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ def _authn_response(self, in_response_to, consumer_url,
307307

308308
if authn: # expected to be a dictionary
309309
# Would like to use dict comprehension but ...
310-
authn_args = dict([(AUTHN_DICT_MAP[k],
311-
v) for k, v in authn.items()])
310+
authn_args = dict([
311+
(AUTHN_DICT_MAP[k], v) for k, v in authn.items()
312+
if k in AUTHN_DICT_MAP])
312313

313314
assertion = ast.construct(sp_entity_id, in_response_to,
314315
consumer_url, name_id,

0 commit comments

Comments
 (0)