mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 23:59:45 +02:00
Feature/user photo storage (#877)
* add default assets for user profile * add recipe avatar * change user_id to UUID * add profile image upload * setup image cache keys * cleanup tests and add image tests * purge user data on delete * new user repository tests * add user_id validator for int -> UUID conversion * delete depreciated route * force set content type * refactor tests to use temp directory * validate parent exists before createing * set user_id to correct type * update instruction id * reset primary key on migration
This commit is contained in:
parent
a2f8f27193
commit
ea7c4771ee
64 changed files with 433 additions and 181 deletions
|
@ -1,9 +1,15 @@
|
|||
from tests.pre_test import settings # isort:skip
|
||||
import os
|
||||
|
||||
os.environ["PRODUCTION"] = "True"
|
||||
os.environ["TESTING"] = "True"
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
from pytest import fixture
|
||||
|
||||
from mealie.app import app
|
||||
from mealie.core import config
|
||||
from mealie.db.db_setup import SessionLocal, generate_session
|
||||
from mealie.db.init_db import main
|
||||
from tests import data as test_data
|
||||
|
@ -28,6 +34,7 @@ def api_client():
|
|||
yield TestClient(app)
|
||||
|
||||
try:
|
||||
settings = config.get_app_settings()
|
||||
settings.DB_PROVIDER.db_path.unlink() # Handle SQLite Provider
|
||||
except Exception:
|
||||
pass
|
||||
|
@ -41,3 +48,19 @@ def test_image_jpg():
|
|||
@fixture(scope="session")
|
||||
def test_image_png():
|
||||
return test_data.images_test_image_2
|
||||
|
||||
|
||||
@fixture(scope="session", autouse=True)
|
||||
def global_cleanup() -> None:
|
||||
"""Purges the .temp directory used for testing"""
|
||||
yield None
|
||||
try:
|
||||
temp_dir = Path(__file__).parent / ".temp"
|
||||
|
||||
if temp_dir.exists():
|
||||
import shutil
|
||||
|
||||
shutil.rmtree(temp_dir, ignore_errors=True)
|
||||
|
||||
except Exception:
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue