1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 07:39:41 +02:00
mealie/tests/integration_tests/test_migration_routes.py
Hayden 2ce195a0d4
refactor: ♻️ rewrite migrations frontend/backend (#841)
* refactor(frontend): ♻️ rewrite migrations UI

* refactor(backend): ♻️ rewrite recipe migrations

* remove vue-demi

Co-authored-by: hay-kot <hay-kot@pm.me>
2021-11-26 22:37:06 -09:00

49 lines
1.2 KiB
Python

from pathlib import Path
import pytest
from fastapi.testclient import TestClient
from tests.test_config import TEST_CHOWDOWN_DIR, TEST_NEXTCLOUD_DIR
from tests.utils.fixture_schemas import TestUser
class Routes:
base = "/api/groups/migrations"
@staticmethod
def report(item_id: str) -> str:
return f"/api/groups/reports/{item_id}"
@pytest.mark.parametrize(
"m_type, zip_path",
[
("nextcloud", TEST_NEXTCLOUD_DIR.joinpath("nextcloud.zip")),
("chowdown", TEST_CHOWDOWN_DIR.joinpath("test_chowdown-gh-pages.zip")),
],
)
def test_migration_nextcloud(api_client: TestClient, zip_path: Path, m_type: str, unique_user: TestUser):
payload = {
"archive": zip_path.read_bytes(),
}
data = {
"migration_type": m_type,
}
response = api_client.post(Routes.base, data=data, files=payload, headers=unique_user.token)
assert response.status_code == 200
id = response.json()["id"]
response = api_client.get(Routes.report(id), headers=unique_user.token)
assert response.status_code == 200
report = response.json()
assert report.get("status") == "success"
for entry in report.get("entries"):
assert entry.get("success") is True