mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 21:15:22 +02:00
feat: ✨ Paprika/Mealie Migration support (#873)
* feat: ✨ paprika support - partial * feat: ✨ add full paprika support * re-organize data directory * add data directory auto-gen * rewrite migration tests * remove print statements * remove hard-coded paths * add auto-tag support * add mealie migration support * add looking for migraiton button
This commit is contained in:
parent
5839992c19
commit
8d77f4b31e
76 changed files with 718 additions and 4056 deletions
|
@ -0,0 +1,55 @@
|
|||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from mealie.schema.group.group_migration import SupportedMigrations
|
||||
from tests import data as test_data
|
||||
from tests.utils.fixture_schemas import TestUser
|
||||
|
||||
|
||||
class Routes:
|
||||
base = "/api/groups/migrations"
|
||||
|
||||
def report(item_id: str) -> str:
|
||||
return f"/api/groups/reports/{item_id}"
|
||||
|
||||
|
||||
@dataclass
|
||||
class MigrationTestData:
|
||||
typ: SupportedMigrations
|
||||
archive: Path
|
||||
|
||||
|
||||
test_cases = [
|
||||
MigrationTestData(typ=SupportedMigrations.nextcloud, archive=test_data.migrations_nextcloud),
|
||||
MigrationTestData(typ=SupportedMigrations.paprika, archive=test_data.migrations_paprika),
|
||||
MigrationTestData(typ=SupportedMigrations.chowdown, archive=test_data.migrations_chowdown),
|
||||
MigrationTestData(typ=SupportedMigrations.mealie_alpha, archive=test_data.migrations_mealie),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("mig", test_cases)
|
||||
def test_recipe_migration(api_client: TestClient, unique_user: TestUser, mig: MigrationTestData) -> None:
|
||||
payload = {
|
||||
"migration_type": mig.typ.value,
|
||||
}
|
||||
|
||||
file_payload = {
|
||||
"archive": mig.archive.read_bytes(),
|
||||
}
|
||||
|
||||
response = api_client.post(Routes.base, data=payload, files=file_payload, headers=unique_user.token)
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
report_id = response.json()["id"]
|
||||
|
||||
# Validate Results
|
||||
response = api_client.get(Routes.report(report_id), headers=unique_user.token)
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
for item in response.json()["entries"]:
|
||||
assert item["success"]
|
Loading…
Add table
Add a link
Reference in a new issue