diff --git a/lacommunaute/forum_file/tests/test_admin.py b/lacommunaute/forum_file/tests/test_admin.py index eaa416698..d64efa4fe 100644 --- a/lacommunaute/forum_file/tests/test_admin.py +++ b/lacommunaute/forum_file/tests/test_admin.py @@ -7,7 +7,7 @@ from django.conf import settings from django.core.files.uploadedfile import SimpleUploadedFile from django.urls import reverse -from moto import mock_s3 +from moto import mock_aws from PIL import Image from lacommunaute.forum_file.models import PublicFile @@ -34,7 +34,7 @@ def image_content_fixture(): return buffer.getvalue() -@mock_s3 +@mock_aws def test_file_is_saved_with_logged_user(client, db, superuser, image_content): conn = boto3.client("s3", endpoint_url=settings.AWS_S3_ENDPOINT_URL, region_name="us-east-1") conn.create_bucket(Bucket=settings.AWS_STORAGE_BUCKET_NAME_PUBLIC) diff --git a/lacommunaute/forum_file/tests/test_models.py b/lacommunaute/forum_file/tests/test_models.py index 11c8921f2..e4ea3ac62 100644 --- a/lacommunaute/forum_file/tests/test_models.py +++ b/lacommunaute/forum_file/tests/test_models.py @@ -13,7 +13,7 @@ @pytest.fixture(name="s3_bucket") def s3_bucket_fixture(): - with moto.mock_s3(): + with moto.mock_aws(): yield settings.AWS_STORAGE_BUCKET_NAME_PUBLIC diff --git a/lacommunaute/notification/tests/tests_emails.py b/lacommunaute/notification/tests/tests_emails.py index 8d9590473..7e49befae 100644 --- a/lacommunaute/notification/tests/tests_emails.py +++ b/lacommunaute/notification/tests/tests_emails.py @@ -17,7 +17,7 @@ class SendEmailTestCase(TestCase): @classmethod def setUpTestData(cls): - respx.post(SIB_SMTP_URL).mock(return_value=httpx.Response(200, json={"message": "OK"})) + respx.post(SIB_SMTP_URL).mock(return_value=httpx.Response(200, text='{"message": "OK"}')) cls.to = [{"email": faker.email()}] cls.params = faker.text() cls.template_id = faker.random_int() @@ -52,7 +52,7 @@ def test_send_email_with_bcc(self): class BulkSendUserToListTestCase(TestCase): @classmethod def setUpTestData(cls): - respx.post(SIB_CONTACTS_URL).mock(return_value=httpx.Response(200, json={"message": "OK"})) + respx.post(SIB_CONTACTS_URL).mock(return_value=httpx.Response(200, text='{"message": "OK"}')) @respx.mock def test_bulk_send_user_to_list(self): diff --git a/lacommunaute/notification/tests/tests_tasks.py b/lacommunaute/notification/tests/tests_tasks.py index b687300b5..ecd23779a 100644 --- a/lacommunaute/notification/tests/tests_tasks.py +++ b/lacommunaute/notification/tests/tests_tasks.py @@ -31,7 +31,7 @@ @pytest.fixture(name="mock_respx_post_to_sib_smtp_url") def mock_respx_post_to_sib_smtp_url_fixture(): with respx.mock: - respx.post(SIB_SMTP_URL).mock(return_value=httpx.Response(200, json={"message": "OK"})) + respx.post(SIB_SMTP_URL).mock(return_value=httpx.Response(200, text='{"message": "OK"}')) yield @@ -109,7 +109,7 @@ def test_num_queries(self, db, django_assert_num_queries, mock_respx_post_to_sib class AddUserToListWhenRegister(TestCase): def setUp(self): super().setUp() - respx.post(SIB_CONTACTS_URL).mock(return_value=httpx.Response(200, json={"message": "OK"})) + respx.post(SIB_CONTACTS_URL).mock(return_value=httpx.Response(200, text='{"message": "OK"}')) @respx.mock def test_add_user_to_list_when_register(self): diff --git a/lacommunaute/users/tests/__snapshots__/tests_views.ambr b/lacommunaute/users/tests/__snapshots__/tests_views.ambr index e53dbb293..cc14792da 100644 --- a/lacommunaute/users/tests/__snapshots__/tests_views.ambr +++ b/lacommunaute/users/tests/__snapshots__/tests_views.ambr @@ -614,8 +614,8 @@ ''' # --- # name: TestSendMagicLink.test_send_magic[PROD-True-0][send_magic_link_payload] - '{"sender": {"name": "La Communaut\\u00e9", "email": "noreply@inclusion.gouv.fr"}, "to": [{"email": "samuel@jackson.com"}], "params": {"display_name": "Samuel J.", "login_link": "LOGIN_LINK"}, "templateId": 31}' + '{"sender":{"name":"La Communauté","email":"noreply@inclusion.gouv.fr"},"to":[{"email":"samuel@jackson.com"}],"params":{"display_name":"Samuel J.","login_link":"LOGIN_LINK"},"templateId":31}' # --- # name: TestSendMagicLink.test_send_magic[TEST-True-0][send_magic_link_payload] - '{"sender": {"name": "La Communaut\\u00e9", "email": "noreply@inclusion.gouv.fr"}, "to": [{"email": "samuel@jackson.com"}], "params": {"display_name": "Samuel J.", "login_link": "LOGIN_LINK"}, "templateId": 31}' + '{"sender":{"name":"La Communauté","email":"noreply@inclusion.gouv.fr"},"to":[{"email":"samuel@jackson.com"}],"params":{"display_name":"Samuel J.","login_link":"LOGIN_LINK"},"templateId":31}' # --- diff --git a/pyproject.toml b/pyproject.toml index 8e9e09c0c..799a99dc7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,49 +8,46 @@ requires-python = ">=3.13" readme = "README.md" dependencies = [ "Django>=5.1", - "python-dotenv>=0.21.0", - "psycopg2-binary>=2.9.3", + "python-dotenv>=1.0", + "psycopg>=3.2", "django-machina>=1.2.0", - "boto3>=1.24.91", - "django-storages>=1.13.1", - "httpx>=0.23.0", - "django-compressor~=4.1", + "boto3>=1.36", + "django-storages>=1.14", + "httpx>=0.28", + "django-compressor>=4.5", "django-libsass>=0.9", - "sentry-sdk~=2.8", + "sentry-sdk>=2.20", "django-social-share>=2.3.0", - "django-htmx>=1.12.2", - "django-taggit>=5.0.1", - "django-csp~=3.7", - "django-permissions-policy>=4.15.0", + "django-htmx>=1.21", + "django-taggit>=6.1", + "django-csp>=3.8", + "django-permissions-policy>=4.24", "langdetect>=1.0.9", - "freezegun>=1.5.1", - "pyjwt>=2.9.03", + "pyjwt>=2.10", ] [dependency-groups] dev = [ - "black>=24.3.0", - "pylint>=2.15.2", - "pylint-django>=2.5.3", - "pre-commit>=2.20.0", - "coverage>=6.4.4", - "django-extensions>=3.2.1", - "django-debug-toolbar>=3.7.0", - "Werkzeug>=3.0.3", - "pytest-django>=4.5.2", - "debugpy>=1.6.3", - "factory-boy>=3.2.1", - "respx>=0.20.0", - "pygithub~=1.57", - "pytest-xdist>=3.2.1", - "pillow>=10.0.0", - "moto>=4.2.2", - "virtualenv>=20.24.6", - "ruff>=0.4.5", - "djlint>=1.34.1", - "syrupy>=4.6.0", - "beautifulsoup4>=4.12.3", + "pylint>=3.3", + "pylint-django>=2.6", + "pre-commit>=4.0", + "coverage>=7.6", + "django-extensions>=3.2", + "django-debug-toolbar>=5.0", + "Werkzeug>=3.1.3", + "pytest-django>=4.9", + "debugpy>=1.8", + "factory-boy>=3.3", + "respx>=0.22", + "pytest-xdist>=3.6", + "pillow>=11.1.0", + "moto>=5.0", + "ruff>=0.9", + "djlint>=1.36", + "syrupy>=4.8", + "beautifulsoup4>=4.12", "html5lib~=1.1", + "freezegun>=1.5.1", ] [tool.ruff] diff --git a/uv.lock b/uv.lock index d873ed1ec..0f1b1c425 100644 --- a/uv.lock +++ b/uv.lock @@ -592,32 +592,30 @@ wheels = [ [[package]] name = "httpcore" -version = "0.16.3" +version = "1.0.7" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "anyio" }, { name = "certifi" }, { name = "h11" }, - { name = "sniffio" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/61/42/5c456b02816845d163fab0f32936b6a5b649f3f915beff6f819f4f6c90b2/httpcore-0.16.3.tar.gz", hash = "sha256:c5d6f04e2fc530f39e0c077e6a30caa53f1451096120f1f38b954afd0b17c0cb", size = 54929 } +sdist = { url = "https://files.pythonhosted.org/packages/6a/41/d7d0a89eb493922c37d343b607bc1b5da7f5be7e383740b4753ad8943e90/httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c", size = 85196 } wheels = [ - { url = "https://files.pythonhosted.org/packages/04/7e/ef97af4623024e8159993b3114ce208de4f677098ae058ec5882a1bf7605/httpcore-0.16.3-py3-none-any.whl", hash = "sha256:da1fb708784a938aa084bde4feb8317056c55037247c787bd7e19eb2c2949dc0", size = 69561 }, + { url = "https://files.pythonhosted.org/packages/87/f5/72347bc88306acb359581ac4d52f23c0ef445b57157adedb9aee0cd689d2/httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd", size = 78551 }, ] [[package]] name = "httpx" -version = "0.23.3" +version = "0.28.1" source = { registry = "https://pypi.org/simple" } dependencies = [ + { name = "anyio" }, { name = "certifi" }, { name = "httpcore" }, - { name = "rfc3986", extra = ["idna2008"] }, - { name = "sniffio" }, + { name = "idna" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/f5/50/04d5e8ee398a10c767a341a25f59ff8711ae3adf0143c7f8b45fc560d72d/httpx-0.23.3.tar.gz", hash = "sha256:9818458eb565bb54898ccb9b8b251a28785dd4a55afbc23d0eb410754fe7d0f9", size = 77527 } +sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406 } wheels = [ - { url = "https://files.pythonhosted.org/packages/ac/a2/0260c0f5d73bdf06e8d3fc1013a82b9f0633dc21750c9e3f3cb1dba7bb8c/httpx-0.23.3-py3-none-any.whl", hash = "sha256:a211fcce9b1254ea24f0cd6af9869b3d29aba40154e947d2a07bb499b3e310d6", size = 71472 }, + { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517 }, ] [[package]] @@ -715,7 +713,7 @@ dependencies = [ { name = "freezegun" }, { name = "httpx" }, { name = "langdetect" }, - { name = "psycopg2-binary" }, + { name = "psycopg" }, { name = "pyjwt" }, { name = "python-dotenv" }, { name = "sentry-sdk" }, @@ -763,10 +761,10 @@ requires-dist = [ { name = "freezegun", specifier = ">=1.5.1" }, { name = "httpx", specifier = ">=0.23.0" }, { name = "langdetect", specifier = ">=1.0.9" }, - { name = "psycopg2-binary", specifier = ">=2.9.3" }, - { name = "pyjwt", specifier = ">=2.9.3" }, - { name = "python-dotenv", specifier = ">=0.21.0" }, - { name = "sentry-sdk", specifier = "~=2.8" }, + { name = "psycopg", specifier = ">=3.2" }, + { name = "pyjwt", specifier = ">=2.10" }, + { name = "python-dotenv", specifier = ">=1.0" }, + { name = "sentry-sdk", specifier = ">=2.20" }, ] [package.metadata.requires-dev] @@ -788,7 +786,7 @@ dev = [ { name = "pylint-django", specifier = ">=2.5.3" }, { name = "pytest-django", specifier = ">=4.5.2" }, { name = "pytest-xdist", specifier = ">=3.2.1" }, - { name = "respx", specifier = ">=0.20.0" }, + { name = "respx", specifier = ">=0.22" }, { name = "ruff", specifier = ">=0.4.5" }, { name = "syrupy", specifier = ">=4.6.0" }, { name = "virtualenv", specifier = ">=20.24.6" }, @@ -979,22 +977,15 @@ wheels = [ ] [[package]] -name = "psycopg2-binary" -version = "2.9.10" +name = "psycopg" +version = "3.2.4" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/cb/0e/bdc8274dc0585090b4e3432267d7be4dfbfd8971c0fa59167c711105a6bf/psycopg2-binary-2.9.10.tar.gz", hash = "sha256:4b3df0e6990aa98acda57d983942eff13d824135fe2250e6522edaa782a06de2", size = 385764 } +dependencies = [ + { name = "tzdata", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e0/f2/954b1467b3e2ca5945b83b5e320268be1f4df486c3e8ffc90f4e4b707979/psycopg-3.2.4.tar.gz", hash = "sha256:f26f1346d6bf1ef5f5ef1714dd405c67fb365cfd1c6cea07de1792747b167b92", size = 156109 } wheels = [ - { url = "https://files.pythonhosted.org/packages/3e/30/d41d3ba765609c0763505d565c4d12d8f3c79793f0d0f044ff5a28bf395b/psycopg2_binary-2.9.10-cp313-cp313-macosx_12_0_x86_64.whl", hash = "sha256:26540d4a9a4e2b096f1ff9cce51253d0504dca5a85872c7f7be23be5a53eb18d", size = 3044699 }, - { url = "https://files.pythonhosted.org/packages/35/44/257ddadec7ef04536ba71af6bc6a75ec05c5343004a7ec93006bee66c0bc/psycopg2_binary-2.9.10-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:e217ce4d37667df0bc1c397fdcd8de5e81018ef305aed9415c3b093faaeb10fb", size = 3275245 }, - { url = "https://files.pythonhosted.org/packages/1b/11/48ea1cd11de67f9efd7262085588790a95d9dfcd9b8a687d46caf7305c1a/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:245159e7ab20a71d989da00f280ca57da7641fa2cdcf71749c193cea540a74f7", size = 2851631 }, - { url = "https://files.pythonhosted.org/packages/62/e0/62ce5ee650e6c86719d621a761fe4bc846ab9eff8c1f12b1ed5741bf1c9b/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3c4ded1a24b20021ebe677b7b08ad10bf09aac197d6943bfe6fec70ac4e4690d", size = 3082140 }, - { url = "https://files.pythonhosted.org/packages/27/ce/63f946c098611f7be234c0dd7cb1ad68b0b5744d34f68062bb3c5aa510c8/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3abb691ff9e57d4a93355f60d4f4c1dd2d68326c968e7db17ea96df3c023ef73", size = 3264762 }, - { url = "https://files.pythonhosted.org/packages/43/25/c603cd81402e69edf7daa59b1602bd41eb9859e2824b8c0855d748366ac9/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8608c078134f0b3cbd9f89b34bd60a943b23fd33cc5f065e8d5f840061bd0673", size = 3020967 }, - { url = "https://files.pythonhosted.org/packages/5f/d6/8708d8c6fca531057fa170cdde8df870e8b6a9b136e82b361c65e42b841e/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:230eeae2d71594103cd5b93fd29d1ace6420d0b86f4778739cb1a5a32f607d1f", size = 2872326 }, - { url = "https://files.pythonhosted.org/packages/ce/ac/5b1ea50fc08a9df82de7e1771537557f07c2632231bbab652c7e22597908/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:bb89f0a835bcfc1d42ccd5f41f04870c1b936d8507c6df12b7737febc40f0909", size = 2822712 }, - { url = "https://files.pythonhosted.org/packages/c4/fc/504d4503b2abc4570fac3ca56eb8fed5e437bf9c9ef13f36b6621db8ef00/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:f0c2d907a1e102526dd2986df638343388b94c33860ff3bbe1384130828714b1", size = 2920155 }, - { url = "https://files.pythonhosted.org/packages/b2/d1/323581e9273ad2c0dbd1902f3fb50c441da86e894b6e25a73c3fda32c57e/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f8157bed2f51db683f31306aa497311b560f2265998122abe1dce6428bd86567", size = 2959356 }, - { url = "https://files.pythonhosted.org/packages/08/50/d13ea0a054189ae1bc21af1d85b6f8bb9bbc5572991055d70ad9006fe2d6/psycopg2_binary-2.9.10-cp313-cp313-win_amd64.whl", hash = "sha256:27422aa5f11fbcd9b18da48373eb67081243662f9b46e6fd07c3eb46e4535142", size = 2569224 }, + { url = "https://files.pythonhosted.org/packages/40/49/15114d5f7ee68983f4e1a24d47e75334568960352a07c6f0e796e912685d/psycopg-3.2.4-py3-none-any.whl", hash = "sha256:43665368ccd48180744cab26b74332f46b63b7e06e8ce0775547a3533883d381", size = 198716 }, ] [[package]] @@ -1236,28 +1227,14 @@ wheels = [ [[package]] name = "respx" -version = "0.20.2" +version = "0.22.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "httpx" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/e6/0b/e0df26ea5c7145d95f1ab8ecb20f0778dd8af718e56747977dca9d28362a/respx-0.20.2.tar.gz", hash = "sha256:07cf4108b1c88b82010f67d3c831dae33a375c7b436e54d87737c7f9f99be643", size = 26080 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/47/47/8c5a8b02c2144770fe353585b6db21e392c4318b8cff897738159feff562/respx-0.20.2-py2.py3-none-any.whl", hash = "sha256:ab8e1cf6da28a5b2dd883ea617f8130f77f676736e6e9e4a25817ad116a172c9", size = 22849 }, -] - -[[package]] -name = "rfc3986" -version = "1.5.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/79/30/5b1b6c28c105629cc12b33bdcbb0b11b5bb1880c6cfbd955f9e792921aa8/rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835", size = 49378 } +sdist = { url = "https://files.pythonhosted.org/packages/f4/7c/96bd0bc759cf009675ad1ee1f96535edcb11e9666b985717eb8c87192a95/respx-0.22.0.tar.gz", hash = "sha256:3c8924caa2a50bd71aefc07aa812f2466ff489f1848c96e954a5362d17095d91", size = 28439 } wheels = [ - { url = "https://files.pythonhosted.org/packages/c4/e5/63ca2c4edf4e00657584608bee1001302bbf8c5f569340b78304f2f446cb/rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97", size = 31976 }, -] - -[package.optional-dependencies] -idna2008 = [ - { name = "idna" }, + { url = "https://files.pythonhosted.org/packages/8e/67/afbb0978d5399bc9ea200f1d4489a23c9a1dad4eee6376242b8182389c79/respx-0.22.0-py2.py3-none-any.whl", hash = "sha256:631128d4c9aba15e56903fb5f66fb1eff412ce28dd387ca3a81339e52dbd3ad0", size = 25127 }, ] [[package]]