|
5 | 5 | from urllib.parse import urlparse |
6 | 6 |
|
7 | 7 | import pytest |
| 8 | +import responses |
8 | 9 | from cryptojwt.key_jar import build_keyjar |
9 | 10 | from oidcendpoint.common.authorization import join_query |
10 | 11 | from oidcendpoint.cookie import CookieDealer |
@@ -515,14 +516,17 @@ def test_logout_from_client(self): |
515 | 516 | with pytest.raises(KeyError): |
516 | 517 | _ = self.session_endpoint.endpoint_context.sdb[_sid] |
517 | 518 |
|
518 | | - def test_do_verified_logout(self, requests_mock): |
519 | | - requests_mock.post("https://example.com/bc_logout", text="OK") |
520 | | - self._code_auth("1234567") |
521 | | - _cdb = self.session_endpoint.endpoint_context.cdb |
522 | | - _cdb["client_1"]["backchannel_logout_uri"] = "https://example.com/bc_logout" |
523 | | - _cdb["client_1"]["client_id"] = "client_1" |
| 519 | + def test_do_verified_logout(self): |
| 520 | + with responses.RequestsMock() as rsps: |
| 521 | + rsps.add("POST", "https://example.com/bc_logout", |
| 522 | + body="OK", status=200) |
524 | 523 |
|
525 | | - _sid = self._get_sid() |
| 524 | + self._code_auth("1234567") |
| 525 | + _cdb = self.session_endpoint.endpoint_context.cdb |
| 526 | + _cdb["client_1"]["backchannel_logout_uri"] = "https://example.com/bc_logout" |
| 527 | + _cdb["client_1"]["client_id"] = "client_1" |
| 528 | + |
| 529 | + _sid = self._get_sid() |
526 | 530 |
|
527 | | - res = self.session_endpoint.do_verified_logout(_sid, "client_1") |
528 | | - assert res == [] |
| 531 | + res = self.session_endpoint.do_verified_logout(_sid, "client_1") |
| 532 | + assert res == [] |
0 commit comments