diff --git a/.travis.yml b/.travis.yml index 6b4b717..ed64d95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ python: install: - pip install -U -r requirements.txt - pip install -U -r test_requirements.txt + - pip install -U flake8 script: - echo "Running tests in job stages..." @@ -28,4 +29,4 @@ jobs: name: "Flake8 Check" script: - echo "Code Style check..." - - "flake8 okta_jwt_verifier/" + - "flake8 --extend-ignore=E501 okta_jwt_verifier/" diff --git a/okta_jwt_verifier/jwt_verifier.py b/okta_jwt_verifier/jwt_verifier.py index 85eece4..23481ae 100644 --- a/okta_jwt_verifier/jwt_verifier.py +++ b/okta_jwt_verifier/jwt_verifier.py @@ -278,7 +278,7 @@ def __init__(self, proxy=proxy) -class AccessTokenVerifier(BaseJWTVerifier): +class AccessTokenVerifier(): def __init__(self, issuer=None, audience='api://default', @@ -339,16 +339,16 @@ def __init__(self, leeway: int, amount of time to expand the window for token expiration (to work around clock skew) cache_jwks: bool, optional """ - self._jwt_verifier = JWTVerifier(issuer, - client_id, - audience, - request_executor, - max_retries, - request_timeout, - max_requests, - leeway, - cache_jwks, - proxy) + self._jwt_verifier = BaseJWTVerifier(issuer, + client_id, + audience, + request_executor, + max_retries, + request_timeout, + max_requests, + leeway, + cache_jwks, + proxy) async def verify(self, token, claims_to_verify=('iss', 'exp'), nonce=None): await self._jwt_verifier.verify_id_token(token, claims_to_verify, nonce) diff --git a/tests/unit/test_jwt_verifier.py b/tests/unit/test_jwt_verifier.py index 1f8fd87..e55b9d8 100644 --- a/tests/unit/test_jwt_verifier.py +++ b/tests/unit/test_jwt_verifier.py @@ -278,3 +278,24 @@ def test_verify_expiration(mocker): def test_deprecation_warning(): with pytest.warns(DeprecationWarning): jwt_verifier = JWTVerifier(issuer='https://test_issuer.com') + + +def test_no_deprecation_warning(): + # there is no nice way to check it, so use workaround with try/except/else + try: + with pytest.warns(DeprecationWarning): + jwt_verifier = AccessTokenVerifier(issuer='https://test_issuer.com') + except: + # this means "no deprecation warning" + assert True + else: + assert False + + try: + with pytest.warns(DeprecationWarning): + jwt_verifier = IDTokenVerifier(issuer='https://test_issuer.com') + except: + # this means "no deprecation warning" + assert True + else: + assert False