From 804af5b33930373257eae81c351103e49af04442 Mon Sep 17 00:00:00 2001 From: Roland Hedberg Date: Wed, 30 Mar 2022 16:31:17 +0200 Subject: [PATCH] Fixed Configure tests. --- src/idpyoidc/configure.py | 12 ++++++++---- src/idpyoidc/server/configure.py | 4 ++-- tests/test_server_00_configure.py | 11 ++++++++--- tests/test_server_20a_server.py | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/idpyoidc/configure.py b/src/idpyoidc/configure.py index 62500826..bf80e160 100644 --- a/src/idpyoidc/configure.py +++ b/src/idpyoidc/configure.py @@ -225,16 +225,20 @@ def __init__(self, self.web_conf = lower_or_upper(self.conf, "webserver") if entity_conf: - skip = [ec["path"] for ec in entity_conf] + skip = [ec["path"] for ec in entity_conf if 'path' in ec] + check = [l[0] for l in skip] self.extend(conf=self.conf, base_path=base_path, domain=self.domain, port=self.port, entity_conf=entity_conf, file_attributes=self._file_attributes, dir_attributes=self._dir_attributes) for key, val in conf.items(): - for path in skip: - if key == path[0]: - continue + if key in ["logging", "webserver", "domain", "port"]: + continue + + if key in check: + continue + setattr(self, key, val) else: for key, val in conf.items(): diff --git a/src/idpyoidc/server/configure.py b/src/idpyoidc/server/configure.py index 3dfb1928..d5e6b250 100755 --- a/src/idpyoidc/server/configure.py +++ b/src/idpyoidc/server/configure.py @@ -149,7 +149,7 @@ class EntityConfiguration(Base): "endpoint": {}, "httpc_params": {}, "issuer": "", - "keys": None, + "key_conf": None, "session_params": None, "template_dir": None, "token_handler_args": {}, @@ -171,7 +171,7 @@ def __init__( Base.__init__(self, conf, base_path, file_attributes=file_attributes, dir_attributes=dir_attributes, domain=domain, port=port) - self.key_conf = conf.get('key_conf') + self.key_conf = conf.get('key_conf', conf.get('keys')) for key in self.parameter.keys(): _val = conf.get(key) diff --git a/tests/test_server_00_configure.py b/tests/test_server_00_configure.py index f70a04a9..3d575caf 100644 --- a/tests/test_server_00_configure.py +++ b/tests/test_server_00_configure.py @@ -1,12 +1,11 @@ import json import os -import pytest - from idpyoidc.configure import Configuration from idpyoidc.configure import create_from_config_file from idpyoidc.logging import configure_logging from idpyoidc.server.configure import OPConfiguration +import pytest BASEDIR = os.path.abspath(os.path.dirname(__file__)) @@ -99,7 +98,13 @@ def test_op_configure_default_from_file(): def test_server_configure(): configuration = create_from_config_file( Configuration, - entity_conf=[{"class": OPConfiguration, "attr": "op", "path": ["op", "server_info"]}], + entity_conf=[ + { + "class": OPConfiguration, + "attr": "op", + "path": ["op", "server_info"] + } + ], filename=full_path("srv_config.json"), base_path=BASEDIR, ) diff --git a/tests/test_server_20a_server.py b/tests/test_server_20a_server.py index 6454ff80..cfa136f4 100755 --- a/tests/test_server_20a_server.py +++ b/tests/test_server_20a_server.py @@ -111,7 +111,7 @@ def test_capabilities_default(): "code id_token token", } assert server.endpoint_context.provider_info["request_uri_parameter_supported"] is True - assert server.endpoint_context.jwks_uri == 'https://127.0.0.1:80/static/jwks.json' + assert server.endpoint_context.jwks_uri == 'https://127.0.0.1:443/static/jwks.json' def test_capabilities_subset1():