Merge branch 'issue-161-flask' into 'main'

update to flask 3

See merge request yaal/canaille!163
This commit is contained in:
Éloi Rivard 2023-12-14 21:20:11 +00:00
commit 23923a69cf
8 changed files with 38 additions and 35 deletions

View file

@ -6,7 +6,8 @@ and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0
Changed
*******
- Convert all the png in webp. :pr:`182`
- Convert all the png in webp. :pr:`162`
- Update to flask 3 :issue:`161` :pr:`163`
[0.0.37] - 2023-12-01
=====================
@ -14,7 +15,7 @@ Changed
Fixed
*****
- Handle 4xx and 5xx error codes with htmx. :issue:`171` :pr:`181`
- Handle 4xx and 5xx error codes with htmx. :issue:`171` :pr:`161`
[0.0.36] - 2023-12-01
=====================

29
poetry.lock generated
View file

@ -566,21 +566,22 @@ typing = ["typing-extensions (>=4.8)"]
[[package]]
name = "flask"
version = "2.2.5"
version = "3.0.0"
description = "A simple framework for building complex web applications."
optional = false
python-versions = ">=3.7"
python-versions = ">=3.8"
files = [
{file = "Flask-2.2.5-py3-none-any.whl", hash = "sha256:58107ed83443e86067e41eff4631b058178191a355886f8e479e347fa1285fdf"},
{file = "Flask-2.2.5.tar.gz", hash = "sha256:edee9b0a7ff26621bd5a8c10ff484ae28737a2410d99b0bb9a6850c7fb977aa0"},
{file = "flask-3.0.0-py3-none-any.whl", hash = "sha256:21128f47e4e3b9d597a3e8521a329bf56909b690fcc3fa3e477725aa81367638"},
{file = "flask-3.0.0.tar.gz", hash = "sha256:cfadcdb638b609361d29ec22360d6070a77d7463dcb3ab08d2c2f2f168845f58"},
]
[package.dependencies]
click = ">=8.0"
blinker = ">=1.6.2"
click = ">=8.1.3"
importlib-metadata = {version = ">=3.6.0", markers = "python_version < \"3.10\""}
itsdangerous = ">=2.0"
Jinja2 = ">=3.0"
Werkzeug = ">=2.2.2"
itsdangerous = ">=2.1.2"
Jinja2 = ">=3.1.2"
Werkzeug = ">=3.0.0"
[package.extras]
async = ["asgiref (>=3.2)"]
@ -2051,20 +2052,20 @@ tests = ["PasteDeploy", "WSGIProxy2", "coverage", "pyquery", "pytest", "pytest-c
[[package]]
name = "werkzeug"
version = "2.2.3"
version = "3.0.1"
description = "The comprehensive WSGI web application library."
optional = false
python-versions = ">=3.7"
python-versions = ">=3.8"
files = [
{file = "Werkzeug-2.2.3-py3-none-any.whl", hash = "sha256:56433961bc1f12533306c624f3be5e744389ac61d722175d543e1751285da612"},
{file = "Werkzeug-2.2.3.tar.gz", hash = "sha256:2e1ccc9417d4da358b9de6f174e3ac094391ea1d4fbef2d667865d819dfd0afe"},
{file = "werkzeug-3.0.1-py3-none-any.whl", hash = "sha256:90a285dc0e42ad56b34e696398b8122ee4c681833fb35b8334a095d82c56da10"},
{file = "werkzeug-3.0.1.tar.gz", hash = "sha256:507e811ecea72b18a404947aded4b3390e1db8f826b494d76550ef45bb3b1dcc"},
]
[package.dependencies]
MarkupSafe = ">=2.1.1"
[package.extras]
watchdog = ["watchdog"]
watchdog = ["watchdog (>=2.3)"]
[[package]]
name = "wtforms"
@ -2109,4 +2110,4 @@ sql = ["passlib", "sqlalchemy", "sqlalchemy-json", "sqlalchemy-utils"]
[metadata]
lock-version = "2.0"
python-versions = "^3.8"
content-hash = "c5677e8b176239387b62796d963b0e4c6d107f35b4a80c536790b019883687e7"
content-hash = "199d1a9c6d65b9ba32981cf3a27d5db87cca5cd82b7af0e339f815e49c29d917"

View file

@ -38,10 +38,9 @@ include = ["canaille/translations/*/LC_MESSAGES/*.mo"]
[tool.poetry.dependencies]
python = "^3.8"
flask = ">=2.2.2 <2.3"
flask-wtf = "^1.1.1"
flask = "^3.0.0"
flask-wtf = "^1.2.1"
wtforms = "^3.1.1"
werkzeug = ">=2.2.2 <2.3"
# extra : front
email_validator = {version = "^2.0.0", optional=true}

View file

@ -10,6 +10,7 @@ from flask_webtest import TestApp
@pytest.fixture
def configuration(configuration, httpserver):
configuration["SERVER_NAME"] = f"{httpserver.host}:{httpserver.port}"
configuration["WTF_CSRF_ENABLED"] = False
return configuration

View file

@ -60,6 +60,7 @@ def configuration(smtpd):
smtpd.config.use_starttls = True
conf = {
"SECRET_KEY": gen_salt(24),
"SERVER_NAME": "canaille.test",
"JAVASCRIPT": False,
"LOGO": "/static/img/canaille-head.webp",
"TIMEZONE": "UTC",

View file

@ -59,7 +59,7 @@ def test_registration_with_email_validation(testclient, backend, smtpd):
hash=payload.build_hash(),
_external=True,
)
text_mail = str(smtpd.messages[0].get_payload()[0]).replace("=\n", "")
text_mail = smtpd.messages[0].get_payload()[0].get_payload(decode=True).decode()
assert registration_url in text_mail
assert not models.User.query()

View file

@ -26,7 +26,7 @@ def test_get(testclient, backend, client, user):
"https://mydomain.tld/redirect2",
],
"registration_access_token": "static-token",
"registration_client_uri": f"http://localhost/oauth/register/{client.client_id}",
"registration_client_uri": f"http://canaille.test/oauth/register/{client.client_id}",
"token_endpoint_auth_method": "client_secret_basic",
"grant_types": [
"password",
@ -104,7 +104,7 @@ def test_update(testclient, backend, client, user):
"client_secret_expires_at": 0,
"redirect_uris": ["https://newname.example.org/callback"],
"registration_access_token": "static-token",
"registration_client_uri": f"http://localhost/oauth/register/{client.client_id}",
"registration_client_uri": f"http://canaille.test/oauth/register/{client.client_id}",
"token_endpoint_auth_method": "none",
"grant_types": ["refresh_token"],
"response_types": ["code", "token"],

View file

@ -5,12 +5,12 @@ def test_oauth_authorization_server(testclient):
res = testclient.get("/.well-known/oauth-authorization-server", status=200).json
assert "https://auth.mydomain.tld" == res["issuer"]
assert res == {
"authorization_endpoint": "http://localhost/oauth/authorize",
"authorization_endpoint": "http://canaille.test/oauth/authorize",
"code_challenge_methods_supported": ["plain", "S256"],
"introspection_endpoint": "http://localhost/oauth/introspect",
"introspection_endpoint": "http://canaille.test/oauth/introspect",
"issuer": "https://auth.mydomain.tld",
"jwks_uri": "http://localhost/oauth/jwks.json",
"registration_endpoint": "http://localhost/oauth/register",
"jwks_uri": "http://canaille.test/oauth/jwks.json",
"registration_endpoint": "http://canaille.test/oauth/register",
"response_types_supported": [
"code",
"token",
@ -27,7 +27,7 @@ def test_oauth_authorization_server(testclient):
"phone",
"groups",
],
"token_endpoint": "http://localhost/oauth/token",
"token_endpoint": "http://canaille.test/oauth/token",
"token_endpoint_auth_methods_supported": [
"client_secret_basic",
"private_key_jwt",
@ -36,7 +36,7 @@ def test_oauth_authorization_server(testclient):
],
"token_endpoint_auth_signing_alg_values_supported": ["RS256", "ES256"],
"ui_locales_supported": g.available_language_codes,
"userinfo_endpoint": "http://localhost/oauth/userinfo",
"userinfo_endpoint": "http://canaille.test/oauth/userinfo",
}
@ -44,7 +44,7 @@ def test_openid_configuration(testclient):
res = testclient.get("/.well-known/openid-configuration", status=200).json
assert "https://auth.mydomain.tld" == res["issuer"]
assert res == {
"authorization_endpoint": "http://localhost/oauth/authorize",
"authorization_endpoint": "http://canaille.test/oauth/authorize",
"claims_supported": [
"sub",
"iss",
@ -65,12 +65,12 @@ def test_openid_configuration(testclient):
"nonce",
],
"code_challenge_methods_supported": ["plain", "S256"],
"end_session_endpoint": "http://localhost/oauth/end_session",
"end_session_endpoint": "http://canaille.test/oauth/end_session",
"id_token_signing_alg_values_supported": ["RS256", "ES256", "HS256"],
"introspection_endpoint": "http://localhost/oauth/introspect",
"introspection_endpoint": "http://canaille.test/oauth/introspect",
"issuer": "https://auth.mydomain.tld",
"jwks_uri": "http://localhost/oauth/jwks.json",
"registration_endpoint": "http://localhost/oauth/register",
"jwks_uri": "http://canaille.test/oauth/jwks.json",
"registration_endpoint": "http://canaille.test/oauth/register",
"response_types_supported": [
"code",
"token",
@ -88,7 +88,7 @@ def test_openid_configuration(testclient):
"groups",
],
"subject_types_supported": ["pairwise", "public"],
"token_endpoint": "http://localhost/oauth/token",
"token_endpoint": "http://canaille.test/oauth/token",
"token_endpoint_auth_methods_supported": [
"client_secret_basic",
"private_key_jwt",
@ -97,5 +97,5 @@ def test_openid_configuration(testclient):
],
"token_endpoint_auth_signing_alg_values_supported": ["RS256", "ES256"],
"ui_locales_supported": g.available_language_codes,
"userinfo_endpoint": "http://localhost/oauth/userinfo",
"userinfo_endpoint": "http://canaille.test/oauth/userinfo",
}