|
13 | 13 | from cryptojwt.key_bundle import KeyBundle |
14 | 14 | from cryptojwt.key_jar import KeyJar |
15 | 15 |
|
16 | | -from oidcmsg import time_util |
| 16 | +from oidcmsg import time_util, proper_path |
17 | 17 | from oidcmsg.exception import MessageException |
18 | 18 | from oidcmsg.exception import MissingRequiredAttribute |
19 | 19 | from oidcmsg.exception import NotAllowedValue |
20 | 20 | from oidcmsg.exception import OidcMsgError |
21 | 21 | from oidcmsg.exception import WrongSigningAlgorithm |
22 | 22 | from oidcmsg.oauth2 import ResponseMessage, ROPCAccessTokenRequest |
23 | | -from oidcmsg.oidc import AccessTokenRequest, make_openid_request |
| 23 | +from oidcmsg.oidc import AccessTokenRequest, make_openid_request, link_deser |
24 | 24 | from oidcmsg.oidc import dict_deser |
25 | 25 | from oidcmsg.oidc import claims_match |
26 | 26 | from oidcmsg.oidc import link_ser |
@@ -1048,3 +1048,34 @@ def test_factory_2(): |
1048 | 1048 | inst = factory('ROPCAccessTokenRequest', username='me', password='text', |
1049 | 1049 | scope='mar') |
1050 | 1050 | assert isinstance(inst, ROPCAccessTokenRequest) |
| 1051 | + |
| 1052 | + |
| 1053 | +def test_link_deser(): |
| 1054 | + link = Link(href='https://example.com/op', |
| 1055 | + rel="http://openid.net/specs/connect/1.0/issuer") |
| 1056 | + |
| 1057 | + jl = link_ser(link, 'json') |
| 1058 | + l2 = link_deser([jl], 'json') |
| 1059 | + assert isinstance(l2[0], Link) |
| 1060 | + |
| 1061 | + |
| 1062 | +def test_link_deser_dict(): |
| 1063 | + link = Link(href='https://example.com/op', |
| 1064 | + rel="http://openid.net/specs/connect/1.0/issuer") |
| 1065 | + |
| 1066 | + l2 = link_deser([link.to_dict()], 'json') |
| 1067 | + assert isinstance(l2[0], Link) |
| 1068 | + |
| 1069 | + |
| 1070 | +def test_proper_path(): |
| 1071 | + p = proper_path('foo/bar') |
| 1072 | + assert p == './foo/bar/' |
| 1073 | + |
| 1074 | + p = proper_path('/foo/bar') |
| 1075 | + assert p == './foo/bar/' |
| 1076 | + |
| 1077 | + p = proper_path('./foo/bar') |
| 1078 | + assert p == './foo/bar/' |
| 1079 | + |
| 1080 | + p = proper_path('../foo/bar') |
| 1081 | + assert p == './foo/bar/' |
0 commit comments