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

Commit 0123d25

Browse files
committed
chore: unit tests speed up with default http timeout + warning on unknow conf param
1 parent 8690a2b commit 0123d25

25 files changed

Lines changed: 40 additions & 53 deletions

src/oidcop/configure.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
from oidcop.scopes import SCOPE2CLAIMS
1414
from oidcop.utils import load_yaml_config
1515

16+
logger = logging.getLogger(__name__)
17+
18+
1619
DEFAULT_FILE_ATTRIBUTE_NAMES = [
1720
"server_key",
1821
"server_cert",
@@ -84,7 +87,8 @@
8487

8588
AS_DEFAULT_CONFIG = copy.deepcopy(OP_DEFAULT_CONFIG)
8689
AS_DEFAULT_CONFIG["claims_interface"] = {
87-
"class": "oidcop.session.claims.OAuth2ClaimsInterface", "kwargs": {}}
90+
"class": "oidcop.session.claims.OAuth2ClaimsInterface", "kwargs": {}
91+
}
8892

8993

9094
def add_base_path(conf: Union[dict, str], base_path: str, file_attributes: List[str]):
@@ -207,8 +211,6 @@ class EntityConfiguration(Base):
207211
"template_dir": None,
208212
"token_handler_args": {},
209213
"userinfo": None,
210-
"password": None,
211-
"salt": None,
212214
}
213215

214216
def __init__(
@@ -241,7 +243,9 @@ def __init__(
241243
self.format(_val, base_path=base_path, file_attributes=file_attributes,
242244
domain=domain, port=port)
243245
else:
244-
continue
246+
logger.warning(
247+
f"{key} is not a valid configuration parameter"
248+
)
245249

246250
if key == "template_dir":
247251
_val = os.path.abspath(_val)

tests/op_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
}
217217
}
218218
},
219+
"stupid_fake_thing": "asdasd",
219220
"httpc_params": {
220221
"verify": false
221222
},

tests/test_00_server.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ def full_path(local_file):
3636

3737
CONF = {
3838
"issuer": "https://example.com/",
39-
"password": "mycket hemligt",
40-
"verify_ssl": False,
39+
"httpc_params": {"verify": False, "timeout": 1},
4140
"capabilities": {},
4241
"keys": {"uri_path": "static/jwks.json", "key_defs": KEYDEFS, "read_only": True},
4342
"endpoint": {

tests/test_01_util.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212

1313
conf = {
1414
"issuer": "https://example.com/",
15-
"password": "mycket hemligt",
15+
"httpc_params": {"verify": False, "timeout": 1},
1616
"token_expires_in": 600,
1717
"grant_expires_in": 300,
1818
"refresh_token_expires_in": 86400,
19-
"verify_ssl": False,
2019
"capabilities": {},
2120
"jwks_uri": "https://example.com/jwks.json",
2221
"keys": {"private_path": "own/jwks.json", "key_defs": KEYDEFS, "uri_path": "static/jwks.json",},

tests/test_02_client_authn.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@
3636

3737
CONF = {
3838
"issuer": "https://example.com/",
39-
"password": "mycket hemligt",
4039
"grant_expires_in": 300,
41-
"verify_ssl": False,
40+
"httpc_params": {
41+
"verify": False
42+
},
4243
"endpoint": {
4344
"token": {
4445
"path": "token",

tests/test_05_id_token.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ def full_path(local_file):
6464

6565
conf = {
6666
"issuer": "https://example.com/",
67-
"password": "mycket hemligt",
68-
"verify_ssl": False,
67+
"httpc_params": {"verify": False, "timeout": 1},
6968
"keys": {"key_defs": KEYDEFS, "uri_path": "static/jwks.json"},
7069
"token_handler_args": {
7170
"jwks_def": {

tests/test_05_jwt_token.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ class TestEndpoint(object):
9999
def create_endpoint(self):
100100
conf = {
101101
"issuer": ISSUER,
102-
"password": "mycket hemligt",
103-
"verify_ssl": False,
102+
"httpc_params": {"verify": False, "timeout": 1},
104103
"capabilities": CAPABILITIES,
105104
"keys": {"uri_path": "jwks.json", "key_defs": KEYDEFS},
106105
"token_handler_args": {

tests/test_06_session_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ class TestSessionManager:
3737
def create_session_manager(self):
3838
conf = {
3939
"issuer": "https://example.com/",
40-
"password": "mycket hemligt",
40+
"httpc_params": {"verify": False, "timeout": 1},
4141
"token_expires_in": 600,
4242
"grant_expires_in": 300,
4343
"refresh_token_expires_in": 86400,
44-
"verify_ssl": False,
4544
"keys": {"key_defs": KEYDEFS, "uri_path": "static/jwks.json"},
4645
"jwks_uri": "https://example.com/jwks.json",
4746
"token_handler_args": {

tests/test_08_session_life.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ def setup_token_handler(self):
3030
password = "The longer the better. Is this close to enough ?"
3131
conf = {
3232
"issuer": "https://example.com/",
33-
"password": "mycket hemligt",
33+
"httpc_params": {"verify": False, "timeout": 1},
3434
"token_expires_in": 600,
3535
"grant_expires_in": 300,
3636
"refresh_token_expires_in": 86400,
37-
"verify_ssl": False,
3837
"keys": {"key_defs": KEYDEFS, "uri_path": "static/jwks.json"},
3938
"jwks_uri": "https://example.com/jwks.json",
4039
"token_handler_args": {
@@ -249,11 +248,10 @@ class TestSessionJWTToken:
249248
def setup_session_manager(self):
250249
conf = {
251250
"issuer": ISSUER,
252-
"password": "mycket hemligt",
251+
"httpc_params": {"verify": False, "timeout": 1},
253252
"token_expires_in": 600,
254253
"grant_expires_in": 300,
255254
"refresh_token_expires_in": 86400,
256-
"verify_ssl": False,
257255
"capabilities": CAPABILITIES,
258256
"keys": {"uri_path": "jwks.json", "key_defs": KEYDEFS},
259257
"token_handler_args": {

tests/test_09_cookie_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def test_compute_session_state():
249249
#
250250
# conf = {
251251
# "issuer": "https://example.com/",
252-
# "password": "mycket hemligt",
252+
# "httpc_params": {"verify": False, "timeout": 1},
253253
# "token_expires_in": 600,
254254
# "grant_expires_in": 300,
255255
# "refresh_token_expires_in": 86400,

0 commit comments

Comments
 (0)