Fix code style of previous commit

This commit is contained in:
Valentin Samir 2018-04-29 19:04:44 +02:00
parent ff8373ee6a
commit ee69b04b53
2 changed files with 8 additions and 4 deletions

View File

@ -149,12 +149,14 @@ class XmlContent(object):
namespaces={'cas': "http://www.yale.edu/tp/cas"} namespaces={'cas': "http://www.yale.edu/tp/cas"}
) )
self.assertEqual(len(attributes), 1) self.assertEqual(len(attributes), 1)
ignore_attrs = {"authenticationDate", "longTermAuthenticationRequestTokenUsed", "isFromNewLogin"} ignore_attrs = {
"authenticationDate", "longTermAuthenticationRequestTokenUsed", "isFromNewLogin"
}
ignored_attrs = 0 ignored_attrs = 0
attrs1 = set() attrs1 = set()
for attr in attributes[0]: for attr in attributes[0]:
name = attr.tag[len("http://www.yale.edu/tp/cas")+2:] name = attr.tag[len("http://www.yale.edu/tp/cas")+2:]
if not name in ignore_attrs: if name not in ignore_attrs:
attrs1.add((name, attr.text)) attrs1.add((name, attr.text))
else: else:
ignored_attrs += 1 ignored_attrs += 1
@ -164,7 +166,7 @@ class XmlContent(object):
attrs2 = set() attrs2 = set()
for attr in attributes: for attr in attributes:
name = attr.attrib['name'] name = attr.attrib['name']
if not name in ignore_attrs: if name not in ignore_attrs:
attrs2.add((name, attr.attrib['value'])) attrs2.add((name, attr.attrib['value']))
original = set() original = set()
for key, value in original_attributes.items(): for key, value in original_attributes.items():

View File

@ -1907,7 +1907,9 @@ class SamlValidateTestCase(TestCase, BaseServicePattern, XmlContent):
"//samla:AttributeStatement/samla:Attribute", "//samla:AttributeStatement/samla:Attribute",
namespaces={'samla': "urn:oasis:names:tc:SAML:1.0:assertion"} namespaces={'samla': "urn:oasis:names:tc:SAML:1.0:assertion"}
) )
ignore_attrs = {"authenticationDate", "longTermAuthenticationRequestTokenUsed", "isFromNewLogin"} - set(original_attributes.keys()) ignore_attrs = {
"authenticationDate", "longTermAuthenticationRequestTokenUsed", "isFromNewLogin"
} - set(original_attributes.keys())
attrs = set() attrs = set()
for attr in attributes: for attr in attributes:
if not attr.attrib['AttributeName'] in ignore_attrs: if not attr.attrib['AttributeName'] in ignore_attrs: