Skip to content
This repository was archived by the owner on Jun 12, 2021. It is now read-only.

Commit 18e919e

Browse files
committed
Moved to responses.
1 parent 000f80b commit 18e919e

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

tests/test_23_oidc_registration_endpoint.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import json
33

44
import pytest
5+
import responses
6+
57
from oidcendpoint.endpoint_context import EndpointContext
68
from oidcendpoint.id_token import IDToken
79
from oidcendpoint.oidc.authorization import Authorization
@@ -198,16 +200,19 @@ def test_register_custom_redirect_uri_native(self):
198200
_resp = self.endpoint.process_request(request=_req)
199201
assert "response_args" in _resp
200202

201-
def test_sector_uri_missing_redirect_uri(self, httpserver):
203+
def test_sector_uri_missing_redirect_uri(self):
204+
_url = "https://github.com/sector"
205+
202206
_msg = msg.copy()
203207
_msg["redirect_uris"] = ["custom://cb.example.com"]
204208
_msg["application_type"] = "native"
205-
_msg["sector_identifier_uri"] = httpserver.url
209+
_msg["sector_identifier_uri"] = _url
210+
211+
with responses.RequestsMock() as rsps:
212+
rsps.add("GET", _url,
213+
body=json.dumps(["https://example.com", "https://example.org"]),
214+
adding_headers={"Content-Type": "application/json"}, status=200)
206215

207-
httpserver.serve_content(
208-
json.dumps(["https://example.com", "https://example.org"]),
209-
headers={"Content-Type": "application/json"},
210-
)
211216
_req = self.endpoint.parse_request(RegistrationRequest(**_msg).to_json())
212217
_resp = self.endpoint.process_request(request=_req)
213218
assert "error" in _resp

tests/test_30_oidc_end_session.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from urllib.parse import urlparse
66

77
import pytest
8+
import responses
89
from cryptojwt.key_jar import build_keyjar
910
from oidcendpoint.common.authorization import join_query
1011
from oidcendpoint.cookie import CookieDealer
@@ -515,14 +516,17 @@ def test_logout_from_client(self):
515516
with pytest.raises(KeyError):
516517
_ = self.session_endpoint.endpoint_context.sdb[_sid]
517518

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)
524523

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()
526530

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

Comments
 (0)