-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: isoler les settings de test (#864)
## Description 🎸 Isoler les `settings` de test, pour nettoyer les valeurs par défaut des `settings` de base et de dev. 🎸 Utiliser ces `settings` de test pour rendre les tests executables dès le tirage du dépôt. 🎸 Utiliser ces `settings` dans la `CI` pour harmoniser l'execution des tests en local et dans les actions github ## Type de changement 🚧 technique ### Points d'attention 🦺 refactor de l'appel aux settings liés aux envois de mails 🦺 simplification de la gestion des routes `brevo` 🦺 harmonisation des `settings` utilisés pour envoyer le lien magique par mail ou dans les `message` django 🦺 prise en compte des noms de bucket issus des `settings` dans les fichiers de migration 📦 prerequis à la PR #857
- Loading branch information
1 parent
e094434
commit aa14728
Showing
19 changed files
with
120 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,5 @@ | ||
PYTHONPATH=. | ||
|
||
# for Django | ||
DJANGO_SETTINGS_MODULE=config.settings.dev | ||
POSTGRESQL_ADDON_HOST=localhost | ||
POSTGRESQL_ADDON_DB=communaute | ||
POSTGRESQL_ADDON_USER=communaute | ||
POSTGRESQL_ADDON_PASSWORD=password | ||
|
||
# GITHUB_ACCESS_TOKEN is used to update changelog from last release. | ||
GITHUB_ACCESS_TOKEN=__key_to_be_set__ | ||
GITHUB_REPO=betagouv/itou-communaute-django | ||
|
||
# SENDINBLUE API KEY | ||
SIB_API_KEY=__key_to_be_set__ | ||
|
||
# for Sentry | ||
#SENTRY_DSN=__url_to_be_set__ | ||
|
||
# for Pro Connect | ||
OPENID_CONNECT_BASE_URL=http://127.0.0.1:8080 | ||
OPENID_CONNECT_CLIENT_ID=local_openid_connect | ||
OPENID_CONNECT_CLIENT_SECRET=password | ||
|
||
# parking page | ||
PARKING_PAGE=True | ||
|
||
# Path to the itou-backup project repository. | ||
PATH_TO_BACKUPS=~/path/to/backups | ||
|
||
# bucket for test purpose only | ||
CELLAR_ADDON_KEY_ID=minioadmin | ||
CELLAR_ADDON_KEY_SECRET=minioadmin | ||
CELLAR_ADDON_HOST=localhost:9000 | ||
CELLAR_ADDON_PROTOCOL=http | ||
|
||
# itou-backups | ||
export RCLONE_S3_ACCESS_KEY_ID=ACCESS_KEY_ID | ||
export RCLONE_S3_SECRET_ACCESS_KEY=SECRET_ACCESS_KEY | ||
export RCLONE_CRYPT_PASSWORD=CRYPT-PASSWORD | ||
export RCLONE_CRYPT_PASSWORD2=CRYPT-PASSWORD2 | ||
export RCLONE_REMOTE_NAME=communaute | ||
# for psql | ||
PGDATABASE=communaute | ||
PGHOST=localhost | ||
PGUSER=communaute | ||
PGPASSWORD=password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,14 +268,12 @@ | |
# S3 uploads | ||
# ------------------------------------------------------------------------------ | ||
|
||
AWS_S3_ACCESS_KEY_ID = os.getenv("CELLAR_ADDON_KEY_ID", "123") | ||
AWS_S3_SECRET_ACCESS_KEY = os.getenv("CELLAR_ADDON_KEY_SECRET", "secret") | ||
AWS_S3_ENDPOINT_URL = ( | ||
f"{os.getenv('CELLAR_ADDON_PROTOCOL', 'https')}://{os.getenv('CELLAR_ADDON_HOST', 'set-var-env.com')}" | ||
) | ||
AWS_STORAGE_BUCKET_NAME = os.getenv("S3_STORAGE_BUCKET_NAME", "private-bucket") | ||
AWS_STORAGE_BUCKET_NAME_PUBLIC = os.getenv("S3_STORAGE_BUCKET_NAME_PUBLIC", "public-bucket") | ||
AWS_S3_STORAGE_BUCKET_REGION = os.getenv("S3_STORAGE_BUCKET_REGION", "eu-west-3") | ||
AWS_S3_ACCESS_KEY_ID = os.getenv("CELLAR_ADDON_KEY_ID") | ||
AWS_S3_SECRET_ACCESS_KEY = os.getenv("CELLAR_ADDON_KEY_SECRET") | ||
AWS_S3_ENDPOINT_URL = f"{os.getenv('CELLAR_ADDON_PROTOCOL')}://{os.getenv('CELLAR_ADDON_HOST')}" | ||
AWS_STORAGE_BUCKET_NAME = os.getenv("S3_STORAGE_BUCKET_NAME") | ||
AWS_STORAGE_BUCKET_NAME_PUBLIC = os.getenv("S3_STORAGE_BUCKET_NAME_PUBLIC") | ||
AWS_S3_STORAGE_BUCKET_REGION = os.getenv("S3_STORAGE_BUCKET_REGION") | ||
|
||
# MEDIA CONFIGURATION | ||
# ------------------------------------------------------------------------------ | ||
|
@@ -359,11 +357,11 @@ | |
|
||
# SENDINBLUE | ||
# --------------------------------------- | ||
SIB_URL = os.getenv("SIB_URL", "http://test.com") | ||
SIB_SMTP_URL = os.path.join(SIB_URL, "smtp/email") | ||
SIB_CONTACTS_URL = os.path.join(SIB_URL, "contacts/import") | ||
SIB_URL = os.getenv("SIB_URL") | ||
SIB_SMTP_ROUTE = "smtp/email" | ||
SIB_CONTACTS_ROUTE = "contacts/import" | ||
|
||
SIB_API_KEY = os.getenv("SIB_API_KEY", "set-sib-api-key") | ||
SIB_API_KEY = os.getenv("SIB_API_KEY") | ||
DEFAULT_FROM_EMAIL = os.getenv("DEFAULT_FROM_EMAIL", "[email protected]") | ||
|
||
SIB_MAGIC_LINK_TEMPLATE = 31 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
|
||
from lacommunaute.utils.enums import Environment | ||
|
||
from .base import * # pylint: disable=wildcard-import,unused-wildcard-import # noqa: F403 F401 | ||
|
||
|
||
# Django settings | ||
# --------------- | ||
SECRET_KEY = "v3ry_s3cr3t_k3y" | ||
|
||
ENVIRONMENT = Environment.TEST | ||
|
||
# Database | ||
# ------------------------------------------------------------------------------ | ||
DATABASES["default"]["HOST"] = os.getenv("PGHOST", "localhost") # noqa: F405 | ||
DATABASES["default"]["PORT"] = os.getenv("PGPORT", "5432") # noqa: F405 | ||
DATABASES["default"]["NAME"] = os.getenv("PGDATABASE", "communaute") # noqa: F405 | ||
DATABASES["default"]["USER"] = os.getenv("PGUSER", "postgres") # noqa: F405 | ||
DATABASES["default"]["PASSWORD"] = os.getenv("PGPASSWORD", "password") # noqa: F405 | ||
|
||
# S3 uploads | ||
# ------------------------------------------------------------------------------ | ||
|
||
AWS_S3_ACCESS_KEY_ID = os.getenv("CELLAR_ADDON_KEY_ID", "minioadmin") | ||
AWS_S3_SECRET_ACCESS_KEY = os.getenv("CELLAR_ADDON_KEY_SECRET", "minioadmin") | ||
AWS_S3_ENDPOINT_URL = ( | ||
f"{os.getenv('CELLAR_ADDON_PROTOCOL', 'http')}://{os.getenv('CELLAR_ADDON_HOST', 'localhost:9000')}" | ||
) | ||
AWS_STORAGE_BUCKET_NAME = "private-bucket" | ||
AWS_STORAGE_BUCKET_NAME_PUBLIC = "public-bucket" | ||
AWS_S3_STORAGE_BUCKET_REGION = "eu-west-3" | ||
|
||
MEDIA_URL = f"{AWS_S3_ENDPOINT_URL}/" | ||
|
||
# SENDINBLUE | ||
# --------------------------------------- | ||
SIB_URL = "http://test.com" | ||
SIB_API_KEY = "dummy-sib-api-key" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -613,9 +613,9 @@ | |
</main> | ||
''' | ||
# --- | ||
# name: TestSendMagicLink.test_send_magic_link[DEV-1][send_magic_link_payload] | ||
# name: TestSendMagicLink.test_send_magic[PROD-True-0][send_magic_link_payload] | ||
'{"sender": {"name": "La Communaut\\u00e9", "email": "[email protected]"}, "to": [{"email": "[email protected]"}], "params": {"display_name": "Samuel J.", "login_link": "LOGIN_LINK"}, "templateId": 31}' | ||
# --- | ||
# name: TestSendMagicLink.test_send_magic_link[PROD-0][send_magic_link_payload] | ||
# name: TestSendMagicLink.test_send_magic[TEST-True-0][send_magic_link_payload] | ||
'{"sender": {"name": "La Communaut\\u00e9", "email": "[email protected]"}, "to": [{"email": "[email protected]"}], "params": {"display_name": "Samuel J.", "login_link": "LOGIN_LINK"}, "templateId": 31}' | ||
# --- |
Oops, something went wrong.