Add unit tests (#133)
* Add initial test & add pipeline * Add very basic YAML config tests * Add coverage reporting * Add some webserver & template loading tests * Add test cases for the helpers * Implement initial OIDC server tests * Test codestore & discovery checker * Test basics of the config flow * Add test for the HA auth provider * Cleaned up tests & test injection
This commit is contained in:
committed by
GitHub
parent
5714e844a7
commit
404d2451df
@@ -39,12 +39,8 @@ class OIDCDiscoveryInvalid(OIDCClientException):
|
||||
type: Optional[str]
|
||||
details: Optional[dict]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if args:
|
||||
self.message = args[0]
|
||||
else:
|
||||
self.message = "OIDC Discovery document is invalid"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.message = "OIDC Discovery document is invalid"
|
||||
self.type = kwargs.pop("type", None)
|
||||
self.details = kwargs.pop("details", None)
|
||||
super().__init__(self.message)
|
||||
@@ -196,7 +192,7 @@ class OIDCDiscoveryClient:
|
||||
)
|
||||
raise OIDCDiscoveryInvalid(
|
||||
type="does_not_support_response_mode",
|
||||
modes=document["response_modes_supported"],
|
||||
details={"modes": document["response_modes_supported"]},
|
||||
)
|
||||
|
||||
# If grant_types_supported is set, should support 'authorization_code'
|
||||
@@ -281,7 +277,7 @@ class OIDCDiscoveryClient:
|
||||
await self._validate_discovery_document(document)
|
||||
return document
|
||||
|
||||
async def fetch_jwks(self, jwks_uri: str | None):
|
||||
async def fetch_jwks(self, jwks_uri: str | None = None):
|
||||
"""Fetches JWKS."""
|
||||
if jwks_uri is None:
|
||||
discovery_document = await self._fetch_discovery_document()
|
||||
|
||||
Reference in New Issue
Block a user