diff --git a/fittrackee/tests/mixins.py b/fittrackee/tests/mixins.py index 344ce9bc..571db5af 100644 --- a/fittrackee/tests/mixins.py +++ b/fittrackee/tests/mixins.py @@ -241,6 +241,17 @@ class ApiTestCaseMixin(OAuth2Mixin, RandomMixin): error='invalid_client', ) + @staticmethod + def assert_invalid_grant( + response: TestResponse, error_description: Optional[str] = None + ) -> Dict: + return assert_oauth_errored_response( + response, + 400, + error='invalid_grant', + error_description=error_description, + ) + @staticmethod def assert_invalid_request( response: TestResponse, error_description: Optional[str] = None diff --git a/fittrackee/tests/oauth2/test_oauth2_routes.py b/fittrackee/tests/oauth2/test_oauth2_routes.py index 97ee6fb1..76f4d4a3 100644 --- a/fittrackee/tests/oauth2/test_oauth2_routes.py +++ b/fittrackee/tests/oauth2/test_oauth2_routes.py @@ -554,7 +554,7 @@ class TestOAuthIssueAccessToken(OAuthIssueTokenTestCase): headers=dict(content_type='multipart/form-data'), ) - self.assert_invalid_request(response) + self.assert_invalid_grant(response) def test_it_returns_error_when_grant_type_is_not_authorization_code( self, app: Flask, user_1: User @@ -592,7 +592,7 @@ class TestOAuthIssueAccessToken(OAuthIssueTokenTestCase): headers=dict(content_type='multipart/form-data'), ) - self.assert_invalid_request(response) + self.assert_invalid_grant(response) def test_it_returns_access_token(self, app: Flask, user_1: User) -> None: oauth_client, code = self.create_authorized_oauth_client(app, user_1) diff --git a/poetry.lock b/poetry.lock index ff99318e..c260c1d4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -58,7 +58,7 @@ tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (> [[package]] name = "authlib" -version = "1.0.1" +version = "1.1.0" description = "The ultimate Python library in building OAuth and OpenID Connect servers and clients." category = "main" optional = false @@ -781,16 +781,16 @@ plugins = ["importlib-metadata"] [[package]] name = "pyjwt" -version = "2.4.0" +version = "2.5.0" description = "JSON Web Token implementation in Python" category = "main" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" [package.extras] -crypto = ["cryptography (>=3.3.1)"] -dev = ["sphinx", "sphinx-rtd-theme", "zope.interface", "cryptography (>=3.3.1)", "pytest (>=6.0.0,<7.0.0)", "coverage[toml] (==5.0.4)", "mypy", "pre-commit"] -docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"] +crypto = ["cryptography (>=3.3.1)", "types-cryptography (>=3.3.21)"] +dev = ["sphinx (>=4.5.0,<5.0.0)", "sphinx-rtd-theme", "zope.interface", "cryptography (>=3.3.1)", "types-cryptography (>=3.3.21)", "pytest (>=6.0.0,<7.0.0)", "coverage[toml] (==5.0.4)", "pre-commit"] +docs = ["sphinx (>=4.5.0,<5.0.0)", "sphinx-rtd-theme", "zope.interface"] tests = ["pytest (>=6.0.0,<7.0.0)", "coverage[toml] (==5.0.4)"] [[package]] @@ -1535,7 +1535,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "468ee5a0ea6984ed5f6a2a63ffa1de67a0d774bd6405ccefc00536a5ab7d8f42" +content-hash = "461d79977e75199e5c9dfdd9a003f7d0060a01a3b06d6abbf275ca20fd3ab57d" [metadata.files] alabaster = [ @@ -1553,8 +1553,8 @@ async-timeout = [ ] attrs = [] authlib = [ - {file = "Authlib-1.0.1-py2.py3-none-any.whl", hash = "sha256:1286e2d5ef5bfe5a11cc2d0a0d1031f0393f6ce4d61f5121cfe87fa0054e98bd"}, - {file = "Authlib-1.0.1.tar.gz", hash = "sha256:6e74a4846ac36dfc882b3cc2fbd3d9eb410a627f2f2dc11771276655345223b1"}, + {file = "Authlib-1.1.0-py2.py3-none-any.whl", hash = "sha256:be4b6a1dea51122336c210a6945b27a105b9ac572baffd15b07bcff4376c1523"}, + {file = "Authlib-1.1.0.tar.gz", hash = "sha256:0a270c91409fc2b7b0fbee6996e09f2ee3187358762111a9a4225c874b94e891"}, ] babel = [ {file = "Babel-2.10.3-py3-none-any.whl", hash = "sha256:ff56f4892c1c4bf0d814575ea23471c230d544203c7748e8c68f0089478d48eb"}, @@ -2140,8 +2140,8 @@ pygments = [ {file = "Pygments-2.13.0.tar.gz", hash = "sha256:56a8508ae95f98e2b9bdf93a6be5ae3f7d8af858b43e02c5a2ff083726be40c1"}, ] pyjwt = [ - {file = "PyJWT-2.4.0-py3-none-any.whl", hash = "sha256:72d1d253f32dbd4f5c88eaf1fdc62f3a19f676ccbadb9dbc5d07e951b2b26daf"}, - {file = "PyJWT-2.4.0.tar.gz", hash = "sha256:d42908208c699b3b973cbeb01a969ba6a96c821eefb1c5bfe4c390c01d67abba"}, + {file = "PyJWT-2.5.0-py3-none-any.whl", hash = "sha256:8d82e7087868e94dd8d7d418e5088ce64f7daab4b36db654cbaedb46f9d1ca80"}, + {file = "PyJWT-2.5.0.tar.gz", hash = "sha256:e77ab89480905d86998442ac5788f35333fa85f65047a534adc38edf3c88fc3b"}, ] pyopenssl = [ {file = "pyOpenSSL-22.0.0-py2.py3-none-any.whl", hash = "sha256:ea252b38c87425b64116f808355e8da644ef9b07e429398bfece610f893ee2e0"}, diff --git a/pyproject.toml b/pyproject.toml index a622ecd9..f2adc0b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,11 +43,12 @@ pyOpenSSL = "^22.0" ua-parser = "^0.16.1" Babel = "^2.10.3" Werkzeug = "2.1" # removal of parse_rule in 2.2 breaks sphinxcontrib-httpdomain autoflask -Authlib = "=1.0.1" +Authlib = "1.1.0" Flask-Limiter = {version = "^2.6.2", extras = ["redis"]} +PyJWT = "^2.5" [tool.poetry.dev-dependencies] -black = "^22.6" +black = "^22.8" freezegun = "^1.2" mypy = "^0.971" pytest = "^7.1"