1+ from copy import copy
2+ from copy import deepcopy
13import io
24import json
35import os
4- from copy import copy
56
6- import yaml
77from cryptojwt .key_jar import build_keyjar
8+ from oidcmsg .storage .abfile import AbstractFileSystem
9+ import yaml
810
9- import oidcop .login_hint
1011from oidcop .configure import OPConfiguration
12+ import oidcop .login_hint
1113from oidcop .oidc .add_on .pkce import add_pkce_support
1214from oidcop .oidc .authorization import Authorization
1315from oidcop .oidc .provider_config import ProviderConfiguration
@@ -32,7 +34,7 @@ def full_path(local_file):
3234
3335KEYJAR = build_keyjar (KEYDEFS )
3436
35- conf = {
37+ CONF = {
3638 "issuer" : "https://example.com/" ,
3739 "password" : "mycket hemligt" ,
3840 "verify_ssl" : False ,
@@ -44,8 +46,8 @@ def full_path(local_file):
4446 "class" : ProviderConfiguration ,
4547 "kwargs" : {},
4648 },
47- "registration_endpoint" : {"path" : "registration" , "class" : Registration , "kwargs" : {},},
48- "authorization_endpoint" : {"path" : "authorization" , "class" : Authorization , "kwargs" : {},},
49+ "registration_endpoint" : {"path" : "registration" , "class" : Registration , "kwargs" : {}, },
50+ "authorization_endpoint" : {"path" : "authorization" , "class" : Authorization , "kwargs" : {}, },
4951 "token_endpoint" : {"path" : "token" , "class" : Token , "kwargs" : {}},
5052 "userinfo_endpoint" : {
5153 "path" : "userinfo" ,
@@ -114,14 +116,14 @@ def test_capabilities_default():
114116
115117
116118def test_capabilities_subset1 ():
117- _cnf = copy ( conf )
119+ _cnf = deepcopy ( CONF )
118120 _cnf ["capabilities" ] = {"response_types_supported" : ["code" ]}
119121 server = Server (_cnf )
120122 assert server .endpoint_context .provider_info ["response_types_supported" ] == ["code" ]
121123
122124
123125def test_capabilities_subset2 ():
124- _cnf = copy ( conf )
126+ _cnf = deepcopy ( CONF )
125127 _cnf ["capabilities" ] = {"response_types_supported" : ["code" , "id_token" ]}
126128 server = Server (_cnf )
127129 assert set (server .endpoint_context .provider_info ["response_types_supported" ]) == {
@@ -131,15 +133,29 @@ def test_capabilities_subset2():
131133
132134
133135def test_capabilities_bool ():
134- _cnf = copy ( conf )
136+ _cnf = deepcopy ( CONF )
135137 _cnf ["capabilities" ] = {"request_uri_parameter_supported" : False }
136138 server = Server (_cnf )
137139 assert server .endpoint_context .provider_info ["request_uri_parameter_supported" ] is False
138140
139141
140142def test_cdb ():
141- server = Server (conf )
143+ _cnf = deepcopy (CONF )
144+ server = Server (_cnf )
142145 _clients = yaml .safe_load (io .StringIO (client_yaml ))
143146 server .endpoint_context .cdb = _clients ["oidc_clients" ]
144147
145148 assert set (server .endpoint_context .cdb .keys ()) == {"client1" , "client2" , "client3" }
149+
150+
151+ def test_cdb_afs ():
152+ _cnf = copy (CONF )
153+ _cnf ["client_db" ] = {
154+ "class" : 'oidcmsg.storage.abfile.AbstractFileSystem' ,
155+ "kwargs" : {
156+ 'fdir' : full_path ("afs" ),
157+ 'value_conv' : 'oidcmsg.util.JSON'
158+ }
159+ }
160+ server = Server (_cnf )
161+ assert isinstance (server .endpoint_context .cdb , AbstractFileSystem )
0 commit comments