35
35
36
36
MDS = MetadataStore (ONTS .values (), ATTRCONV , sec_config ,
37
37
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" ),)]}])
39
40
40
41
41
42
def _eq (l1 , l2 ):
@@ -46,7 +47,7 @@ def test_filter_ava():
46
47
policy = Policy ({
47
48
"default" : {
48
49
"lifetime" : {"minutes" : 15 },
49
- #"attribute_restrictions": None # means all I have
50
+ # "attribute_restrictions": None # means all I have
50
51
"entity_categories" : ["swamid" ]
51
52
}
52
53
})
@@ -64,7 +65,7 @@ def test_filter_ava2():
64
65
policy = Policy ({
65
66
"default" : {
66
67
"lifetime" : {"minutes" : 15 },
67
- #"attribute_restrictions": None # means all I have
68
+ # "attribute_restrictions": None # means all I have
68
69
"entity_categories" : ["refeds" , "edugain" ]
69
70
}
70
71
})
@@ -84,14 +85,15 @@ def test_filter_ava3():
84
85
policy = Policy ({
85
86
"default" : {
86
87
"lifetime" : {"minutes" : 15 },
87
- #"attribute_restrictions": None # means all I have
88
+ # "attribute_restrictions": None # means all I have
88
89
"entity_categories" : ["swamid" ]
89
90
}
90
91
})
91
92
92
- mds = MetadataStore (ONTS .values (), ATTRCONV , sec_config ,
93
+ mds = MetadataStore (list ( ONTS .values () ), ATTRCONV , sec_config ,
93
94
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" ),)]}])
95
97
96
98
ava = {"givenName" : ["Derek" ], "sn" : ["Jeter" ],
97
99
"mail" : [
"[email protected] " ],
"c" : [
"USA" ],
@@ -107,14 +109,15 @@ def test_filter_ava4():
107
109
policy = Policy ({
108
110
"default" : {
109
111
"lifetime" : {"minutes" : 15 },
110
- #"attribute_restrictions": None # means all I have
112
+ # "attribute_restrictions": None # means all I have
111
113
"entity_categories" : ["swamid" ]
112
114
}
113
115
})
114
116
115
- mds = MetadataStore (ONTS .values (), ATTRCONV , sec_config ,
117
+ mds = MetadataStore (list ( ONTS .values () ), ATTRCONV , sec_config ,
116
118
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" ),)]}])
118
121
119
122
ava = {"givenName" : ["Derek" ], "sn" : ["Jeter" ],
120
123
"mail" : [
"[email protected] " ],
"c" : [
"USA" ],
@@ -123,22 +126,24 @@ def test_filter_ava4():
123
126
124
127
ava = policy .filter (ava , "urn:mace:example.com:saml:roland:sp" , mds )
125
128
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" ])
128
132
129
133
130
134
def test_filter_ava5 ():
131
135
policy = Policy ({
132
136
"default" : {
133
137
"lifetime" : {"minutes" : 15 },
134
- #"attribute_restrictions": None # means all I have
138
+ # "attribute_restrictions": None # means all I have
135
139
"entity_categories" : ["swamid" ]
136
140
}
137
141
})
138
142
139
- mds = MetadataStore (ONTS .values (), ATTRCONV , sec_config ,
143
+ mds = MetadataStore (list ( ONTS .values () ), ATTRCONV , sec_config ,
140
144
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" ),)]}])
142
147
143
148
ava = {"givenName" : ["Derek" ], "sn" : ["Jeter" ],
144
149
"mail" : [
"[email protected] " ],
"c" : [
"USA" ],
@@ -162,7 +167,9 @@ def test_idp_policy_filter():
162
167
idp .metadata )
163
168
164
169
print (ava )
165
- assert list (ava .keys ()) == ["eduPersonTargetedID" ] # because no entity category
170
+ assert list (ava .keys ()) == [
171
+ "eduPersonTargetedID" ] # because no entity category
172
+
166
173
167
174
if __name__ == "__main__" :
168
- test_idp_policy_filter ()
175
+ test_filter_ava3 ()
0 commit comments