Skip to content

Commit 189871d

Browse files
committed
Fix tests after changes in state presence
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent e66bfcb commit 189871d

File tree

4 files changed

+2
-10
lines changed

4 files changed

+2
-10
lines changed

tests/satosa/backends/test_bitbucket.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ def test_authn_response(self, incoming_authn_response):
159159
mock_do_access_token_request
160160

161161
self.bb_backend._authn_response(incoming_authn_response)
162-
assert self.bb_backend.name not in incoming_authn_response.state
163162

164163
self.assert_expected_attributes()
165164
self.assert_token_request(**mock_do_access_token_request.call_args[1])
@@ -190,5 +189,4 @@ def test_entire_flow(self, context):
190189
"state": mock_get_state.return_value
191190
}
192191
self.bb_backend._authn_response(context)
193-
assert self.bb_backend.name not in context.state
194192
self.assert_expected_attributes()

tests/satosa/backends/test_oauth.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ def test_authn_response(self, incoming_authn_response):
136136
self.fb_backend.consumer.do_access_token_request = mock_do_access_token_request
137137

138138
self.fb_backend._authn_response(incoming_authn_response)
139-
assert self.fb_backend.name not in incoming_authn_response.state
140139

141140
self.assert_expected_attributes()
142141
self.assert_token_request(**mock_do_access_token_request.call_args[1])
@@ -164,5 +163,4 @@ def test_entire_flow(self, context):
164163
"state": mock_get_state.return_value
165164
}
166165
self.fb_backend._authn_response(context)
167-
assert self.fb_backend.name not in context.state
168166
self.assert_expected_attributes()

tests/satosa/backends/test_openid_connect.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ def test_response_endpoint(self, backend_config, internal_attributes, userinfo,
163163
self.setup_userinfo_endpoint(backend_config["provider_metadata"]["userinfo_endpoint"], userinfo)
164164

165165
self.oidc_backend.response_endpoint(incoming_authn_response)
166-
assert self.oidc_backend.name not in incoming_authn_response.state
167166

168167
args = self.oidc_backend.auth_callback_func.call_args[0]
169168
assert isinstance(args[0], Context)
@@ -198,7 +197,6 @@ def test_entire_flow(self, context, backend_config, internal_attributes, userinf
198197
"token_type": "Bearer",
199198
}
200199
self.oidc_backend.response_endpoint(context)
201-
assert self.oidc_backend.name not in context.state
202200
args = self.oidc_backend.auth_callback_func.call_args[0]
203201
self.assert_expected_attributes(internal_attributes, userinfo, args[1].attributes)
204202

tests/satosa/backends/test_saml2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,12 @@ def test_full_flow(self, context, idp_conf, sp_conf):
132132
disco_resp = parse_qs(urlparse(resp.message).query)
133133
info = parse_qs(urlparse(disco_resp["return"][0]).query)
134134
info["entityID"] = idp_conf["entityid"]
135-
request_context = Context()
135+
request_context = context
136136
request_context.request = info
137137
request_context.state = context.state
138138

139139
# pass discovery response to backend and check that it redirects to the selected IdP
140+
context.state["SATOSA_BASE"] = {"requester": "the-service-identifier"}
140141
resp = self.samlbackend.disco_response(request_context)
141142
assert_redirect_to_idp(resp, idp_conf)
142143

@@ -155,7 +156,6 @@ def test_full_flow(self, context, idp_conf, sp_conf):
155156
# pass auth response to backend and verify behavior
156157
self.samlbackend.authn_response(response_context, response_binding)
157158
context, internal_resp = self.samlbackend.auth_callback_func.call_args[0]
158-
assert self.samlbackend.name not in context.state
159159
assert context.state[test_state_key] == "my_state"
160160
assert_authn_response(internal_resp)
161161

@@ -254,7 +254,6 @@ def test_authn_response(self, context, idp_conf, sp_conf):
254254

255255
context, internal_resp = self.samlbackend.auth_callback_func.call_args[0]
256256
assert_authn_response(internal_resp)
257-
assert self.samlbackend.name not in context.state
258257

259258
@pytest.mark.skipif(
260259
saml2.__version__ < '4.6.1',
@@ -290,7 +289,6 @@ def test_authn_response_no_name_id(self, context, idp_conf, sp_conf):
290289

291290
context, internal_resp = backend.auth_callback_func.call_args[0]
292291
assert_authn_response(internal_resp)
293-
assert backend.name not in context.state
294292

295293
def test_authn_response_with_encrypted_assertion(self, sp_conf, context):
296294
with open(os.path.join(

0 commit comments

Comments
 (0)