Skip to content

Commit

Permalink
Fixed Configure tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rohe committed Mar 30, 2022
1 parent d03c2a1 commit 804af5b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
12 changes: 8 additions & 4 deletions src/idpyoidc/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 2 additions & 2 deletions src/idpyoidc/server/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand All @@ -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)
Expand Down
11 changes: 8 additions & 3 deletions tests/test_server_00_configure.py
Original file line number Diff line number Diff line change
@@ -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__))

Expand Down Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_server_20a_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 804af5b

Please sign in to comment.