3535
3636MDS = MetadataStore (ONTS .values (), ATTRCONV , sec_config ,
3737 disable_ssl_certificate_validation = True )
38- MDS .imp ([{"class" : "saml2.mdstore.MetaDataMD" , "metadata" : [(full_path ("swamid.md" ), )]}])
38+ MDS .imp ([{"class" : "saml2.mdstore.MetaDataMD" ,
39+ "metadata" : [(full_path ("swamid.md" ),)]}])
3940
4041
4142def _eq (l1 , l2 ):
@@ -46,7 +47,7 @@ def test_filter_ava():
4647 policy = Policy ({
4748 "default" : {
4849 "lifetime" : {"minutes" : 15 },
49- #"attribute_restrictions": None # means all I have
50+ # "attribute_restrictions": None # means all I have
5051 "entity_categories" : ["swamid" ]
5152 }
5253 })
@@ -64,7 +65,7 @@ def test_filter_ava2():
6465 policy = Policy ({
6566 "default" : {
6667 "lifetime" : {"minutes" : 15 },
67- #"attribute_restrictions": None # means all I have
68+ # "attribute_restrictions": None # means all I have
6869 "entity_categories" : ["refeds" , "edugain" ]
6970 }
7071 })
@@ -84,14 +85,15 @@ def test_filter_ava3():
8485 policy = Policy ({
8586 "default" : {
8687 "lifetime" : {"minutes" : 15 },
87- #"attribute_restrictions": None # means all I have
88+ # "attribute_restrictions": None # means all I have
8889 "entity_categories" : ["swamid" ]
8990 }
9091 })
9192
92- mds = MetadataStore (ONTS .values (), ATTRCONV , sec_config ,
93+ mds = MetadataStore (list ( ONTS .values () ), ATTRCONV , sec_config ,
9394 disable_ssl_certificate_validation = True )
94- mds .imp ([{"class" : "saml2.mdstore.MetaDataFile" , "metadata" : [(full_path ("entity_cat_sfs_hei.xml" ), )]}])
95+ mds .imp ([{"class" : "saml2.mdstore.MetaDataFile" ,
96+ "metadata" : [(full_path ("entity_cat_sfs_hei.xml" ),)]}])
9597
9698 ava = {"givenName" : ["Derek" ], "sn" : ["Jeter" ],
9799 "mail" : ["derek@nyy.mlb.com" ], "c" : ["USA" ],
@@ -107,14 +109,15 @@ def test_filter_ava4():
107109 policy = Policy ({
108110 "default" : {
109111 "lifetime" : {"minutes" : 15 },
110- #"attribute_restrictions": None # means all I have
112+ # "attribute_restrictions": None # means all I have
111113 "entity_categories" : ["swamid" ]
112114 }
113115 })
114116
115- mds = MetadataStore (ONTS .values (), ATTRCONV , sec_config ,
117+ mds = MetadataStore (list ( ONTS .values () ), ATTRCONV , sec_config ,
116118 disable_ssl_certificate_validation = True )
117- mds .imp ([{"class" : "saml2.mdstore.MetaDataFile" , "metadata" : [(full_path ("entity_cat_re_nren.xml" ), )]}])
119+ mds .imp ([{"class" : "saml2.mdstore.MetaDataFile" ,
120+ "metadata" : [(full_path ("entity_cat_re_nren.xml" ),)]}])
118121
119122 ava = {"givenName" : ["Derek" ], "sn" : ["Jeter" ],
120123 "mail" : ["derek@nyy.mlb.com" ], "c" : ["USA" ],
@@ -123,22 +126,24 @@ def test_filter_ava4():
123126
124127 ava = policy .filter (ava , "urn:mace:example.com:saml:roland:sp" , mds )
125128
126- assert _eq (list (ava .keys ()), ['eduPersonTargetedID' , "givenName" , "c" , "mail" ,
127- "sn" ])
129+ assert _eq (list (ava .keys ()),
130+ ['eduPersonTargetedID' , "givenName" , "c" , "mail" ,
131+ "sn" ])
128132
129133
130134def test_filter_ava5 ():
131135 policy = Policy ({
132136 "default" : {
133137 "lifetime" : {"minutes" : 15 },
134- #"attribute_restrictions": None # means all I have
138+ # "attribute_restrictions": None # means all I have
135139 "entity_categories" : ["swamid" ]
136140 }
137141 })
138142
139- mds = MetadataStore (ONTS .values (), ATTRCONV , sec_config ,
143+ mds = MetadataStore (list ( ONTS .values () ), ATTRCONV , sec_config ,
140144 disable_ssl_certificate_validation = True )
141- mds .imp ([{"class" : "saml2.mdstore.MetaDataFile" , "metadata" : [(full_path ("entity_cat_re.xml" ), )]}])
145+ mds .imp ([{"class" : "saml2.mdstore.MetaDataFile" ,
146+ "metadata" : [(full_path ("entity_cat_re.xml" ),)]}])
142147
143148 ava = {"givenName" : ["Derek" ], "sn" : ["Jeter" ],
144149 "mail" : ["derek@nyy.mlb.com" ], "c" : ["USA" ],
@@ -162,7 +167,9 @@ def test_idp_policy_filter():
162167 idp .metadata )
163168
164169 print (ava )
165- assert list (ava .keys ()) == ["eduPersonTargetedID" ] # because no entity category
170+ assert list (ava .keys ()) == [
171+ "eduPersonTargetedID" ] # because no entity category
172+
166173
167174if __name__ == "__main__" :
168- test_idp_policy_filter ()
175+ test_filter_ava3 ()
0 commit comments