mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 23:59:45 +02:00
feat(frontend): ✨ Fix scheduler, forgot password flow, and minor bug fixes (#725)
* feat(frontend): 💄 add recipe title * fix(frontend): 🐛 fixes #722 side-bar issue * feat(frontend): ✨ Add page titles to all pages * minor cleanup * refactor(backend): ♻️ rewrite scheduler to be more modulare and work * feat(frontend): ✨ start password reset functionality * refactor(backend): ♻️ refactor application settings to facilitate dependency injection * refactor(backend): 🔥 remove RECIPE_SETTINGS env variables in favor of group settings * formatting * refactor(backend): ♻️ align naming convention * feat(backend): ✨ password reset * test(backend): ✅ password reset * feat(frontend): ✨ self-service password reset * purge password schedule * update user creation for tests Co-authored-by: Hayden <hay-kot@pm.me>
This commit is contained in:
parent
d1f0441252
commit
2e9026f9ea
121 changed files with 1461 additions and 679 deletions
|
@ -1,7 +1,6 @@
|
|||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from mealie.core.config import CWD, DATA_DIR, AppDirectories, AppSettings, determine_data_dir, determine_secrets
|
||||
from mealie.core.config import get_app_settings
|
||||
|
||||
|
||||
def test_default_settings(monkeypatch):
|
||||
|
@ -14,12 +13,11 @@ def test_default_settings(monkeypatch):
|
|||
monkeypatch.delenv("API_DOCS", raising=False)
|
||||
monkeypatch.delenv("IS_DEMO", raising=False)
|
||||
|
||||
app_settings = AppSettings()
|
||||
get_app_settings.cache_clear()
|
||||
app_settings = get_app_settings()
|
||||
|
||||
assert app_settings.DEFAULT_GROUP == "Home"
|
||||
assert app_settings.DEFAULT_PASSWORD == "MyPassword"
|
||||
assert app_settings.POSTGRES_USER == "mealie"
|
||||
assert app_settings.POSTGRES_PASSWORD == "mealie"
|
||||
assert app_settings.API_PORT == 9000
|
||||
assert app_settings.API_DOCS is True
|
||||
assert app_settings.IS_DEMO is False
|
||||
|
@ -31,17 +29,14 @@ def test_default_settings(monkeypatch):
|
|||
def test_non_default_settings(monkeypatch):
|
||||
monkeypatch.setenv("DEFAULT_GROUP", "Test Group")
|
||||
monkeypatch.setenv("DEFAULT_PASSWORD", "Test Password")
|
||||
monkeypatch.setenv("POSTGRES_USER", "mealie-test")
|
||||
monkeypatch.setenv("POSTGRES_PASSWORD", "mealie-test")
|
||||
monkeypatch.setenv("API_PORT", "8000")
|
||||
monkeypatch.setenv("API_DOCS", "False")
|
||||
|
||||
app_settings = AppSettings()
|
||||
get_app_settings.cache_clear()
|
||||
app_settings = get_app_settings()
|
||||
|
||||
assert app_settings.DEFAULT_GROUP == "Test Group"
|
||||
assert app_settings.DEFAULT_PASSWORD == "Test Password"
|
||||
assert app_settings.POSTGRES_USER == "mealie-test"
|
||||
assert app_settings.POSTGRES_PASSWORD == "mealie-test"
|
||||
assert app_settings.API_PORT == 8000
|
||||
assert app_settings.API_DOCS is False
|
||||
|
||||
|
@ -51,36 +46,22 @@ def test_non_default_settings(monkeypatch):
|
|||
|
||||
def test_default_connection_args(monkeypatch):
|
||||
monkeypatch.setenv("DB_ENGINE", "sqlite")
|
||||
app_settings = AppSettings()
|
||||
assert re.match(r"sqlite:////.*mealie/dev/data/mealie_v1.0.0b.db", app_settings.DB_URL)
|
||||
get_app_settings.cache_clear()
|
||||
app_settings = get_app_settings()
|
||||
assert re.match(r"sqlite:////.*mealie/dev/data/*mealie*.db", app_settings.DB_URL)
|
||||
|
||||
|
||||
def test_pg_connection_args(monkeypatch):
|
||||
monkeypatch.setenv("DB_ENGINE", "postgres")
|
||||
monkeypatch.setenv("POSTGRES_SERVER", "postgres")
|
||||
app_settings = AppSettings()
|
||||
get_app_settings.cache_clear()
|
||||
app_settings = get_app_settings()
|
||||
assert app_settings.DB_URL == "postgresql://mealie:mealie@postgres:5432/mealie"
|
||||
|
||||
|
||||
def test_secret_generation(tmp_path):
|
||||
app_dirs = AppDirectories(CWD, DATA_DIR)
|
||||
assert determine_secrets(app_dirs.DATA_DIR, False) == "shh-secret-test-key"
|
||||
assert determine_secrets(app_dirs.DATA_DIR, True) != "shh-secret-test-key"
|
||||
|
||||
assert determine_secrets(tmp_path, True) != "shh-secret-test-key"
|
||||
|
||||
|
||||
def test_set_data_dir():
|
||||
global CWD
|
||||
PROD_DIR = Path("/app/data")
|
||||
DEV_DIR = CWD.parent.parent.joinpath("dev", "data")
|
||||
|
||||
assert determine_data_dir(True) == PROD_DIR
|
||||
assert determine_data_dir(False) == DEV_DIR
|
||||
|
||||
|
||||
def test_smtp_enable(monkeypatch):
|
||||
app_settings = AppSettings()
|
||||
get_app_settings.cache_clear()
|
||||
app_settings = get_app_settings()
|
||||
assert app_settings.SMTP_ENABLE is False
|
||||
|
||||
monkeypatch.setenv("SMTP_HOST", "email.mealie.io")
|
||||
|
@ -91,5 +72,7 @@ def test_smtp_enable(monkeypatch):
|
|||
monkeypatch.setenv("SMTP_USER", "mealie@mealie.io")
|
||||
monkeypatch.setenv("SMTP_PASSWORD", "mealie-password")
|
||||
|
||||
app_settings = AppSettings()
|
||||
get_app_settings.cache_clear()
|
||||
app_settings = get_app_settings()
|
||||
|
||||
assert app_settings.SMTP_ENABLE is True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue