Skip to content

Commit

Permalink
To increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rohe committed Oct 6, 2017
1 parent 26f4ecd commit 612ed45
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,10 @@ def test_construct(self, client):
jso = _jwt.payload()
assert _eq(jso.keys(), ["aud", "iss", "sub", "jti", "exp", "iat"])
assert _jwt.headers == {'alg': 'RS256'}
assert jso['aud'] == [client.provider_info['token_endpoint']]


class TestClientSecretJWT(object):
class TestClientSecretJWT_TE(object):
def test_client_secret_jwt(self, client):
client.token_endpoint = "https://example.com/token"
client.provider_info = {'issuer': 'https://example.com/',
Expand All @@ -226,6 +227,34 @@ def test_client_secret_jwt(self, client):
cas, [SYMKey(k=b64e(as_bytes(client.client_secret)))])

assert _eq(info.keys(), ["aud", "iss", "sub", "jti", "exp", "iat"])
assert info['aud'] == [client.provider_info['token_endpoint']]


class TestClientSecretJWT_UI(object):
def test_client_secret_jwt(self, client):
client.token_endpoint = "https://example.com/token"
client.provider_info = {'issuer': 'https://example.com/',
'token_endpoint': "https://example.com/token"}

csj = ClientSecretJWT(client)
cis = AccessTokenRequest()

csj.construct(cis, algorithm="HS256",
authn_endpoint='userinfo')
assert cis["client_assertion_type"] == JWT_BEARER
assert "client_assertion" in cis
cas = cis["client_assertion"]
_jwt = JWT().unpack(cas)
jso = _jwt.payload()
assert _eq(jso.keys(), ["aud", "iss", "sub", "jti", "exp", "iat"])
assert _jwt.headers == {'alg': 'HS256'}

_rj = JWS()
info = _rj.verify_compact(
cas, [SYMKey(k=b64e(as_bytes(client.client_secret)))])

assert _eq(info.keys(), ["aud", "iss", "sub", "jti", "exp", "iat"])
assert info['aud'] == [client.provider_info['issuer']]


class TestValidClientInfo(object):
Expand Down

0 comments on commit 612ed45

Please sign in to comment.