File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
tests/satosa/micro_services Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ import pytest
2+ from satosa .exception import SATOSAError
13from satosa .internal import AuthenticationInformation
24from satosa .internal import InternalData
35from satosa .micro_services .attribute_modifications import FilterAttributeValues
@@ -116,3 +118,43 @@ def test_filter_one_attribute_for_one_target_provider_for_one_requester(self):
116118 }
117119 filtered = filter_service .process (None , resp )
118120 assert filtered .attributes == {"a1" : ["1:foo:bar:2" ]}
121+
122+ def test_filter_one_attribute_from_all_target_providers_for_all_requesters_in_extended_notation (self ):
123+ attribute_filters = {
124+ "" : {
125+ "" : {
126+ "a2" : {
127+ "regexp" : "^foo:bar$"
128+ }
129+ }
130+ }
131+ }
132+ filter_service = self .create_filter_service (attribute_filters )
133+
134+ resp = InternalData (AuthenticationInformation ())
135+ resp .attributes = {
136+ "a1" : ["abc:xyz" ],
137+ "a2" : ["foo:bar" , "1:foo:bar:2" ],
138+ }
139+ filtered = filter_service .process (None , resp )
140+ assert filtered .attributes == {"a1" : ["abc:xyz" ], "a2" : ["foo:bar" ]}
141+
142+ def test_invalid_filter_type (self ):
143+ attribute_filters = {
144+ "" : {
145+ "" : {
146+ "a2" : {
147+ "invalid_filter" : None
148+ }
149+ }
150+ }
151+ }
152+ filter_service = self .create_filter_service (attribute_filters )
153+
154+ resp = InternalData (AuthenticationInformation ())
155+ resp .attributes = {
156+ "a1" : ["abc:xyz" ],
157+ "a2" : ["foo:bar" , "1:foo:bar:2" ],
158+ }
159+ with pytest .raises (SATOSAError ):
160+ filtered = filter_service .process (None , resp )
You can’t perform that action at this time.
0 commit comments