@@ -298,6 +298,7 @@ def test_filter_ava_esi_coco():
298298 "entity_categories" : ["swamid" ]
299299 }
300300 }
301+
301302 policy = Policy (policy_conf , mds )
302303
303304 ava = {
@@ -312,17 +313,29 @@ def test_filter_ava_esi_coco():
312313 ]
313314 }
314315
315- ava = policy .filter (ava , entity_id )
316+ requested_attributes = [
317+ {
318+ 'friendly_name' : 'eduPersonScopedAffiliation' ,
319+ 'name' : '1.3.6.1.4.1.5923.1.1.1.9' ,
320+ 'name_format' : NAME_FORMAT_URI ,
321+ 'is_required' : 'true'
322+ },
323+ {
324+ 'friendly_name' : 'schacHomeOrganization' ,
325+ 'name' : '1.3.6.1.4.1.25178.1.2.9' ,
326+ 'name_format' : NAME_FORMAT_URI ,
327+ 'is_required' : 'true'
328+ }
329+ ]
330+
331+ ava = policy .filter (ava , entity_id , required = requested_attributes )
316332
317333 assert _eq (list (ava .keys ()), [
318- 'mail' ,
319- 'givenName' ,
320- 'sn' ,
321- 'c' ,
322- 'schacHomeOrganization' ,
323334 'eduPersonScopedAffiliation' ,
335+ 'schacHomeOrganization' ,
324336 'schacPersonalUniqueCode'
325337 ])
326- assert _eq (ava ["mail" ], ["test@example.com" ])
338+ assert _eq (ava ["eduPersonScopedAffiliation" ], ["student@example.com" ])
339+ assert _eq (ava ["schacHomeOrganization" ], ["example.com" ])
327340 assert _eq (ava ["schacPersonalUniqueCode" ],
328341 ["urn:schac:personalUniqueCode:int:esi:ladok.se:externtstudentuid-00000000-1111-2222-3333-444444444444" ])
0 commit comments