mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
test: fixed migration routes
This commit is contained in:
parent
c9dc61be8a
commit
363baea829
3 changed files with 8 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
|||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
from pydantic.main import BaseModel
|
||||
|
||||
|
@ -21,4 +22,4 @@ class MigrationFile(BaseModel):
|
|||
|
||||
class Migrations(BaseModel):
|
||||
type: str
|
||||
files: list[MigrationFile] = []
|
||||
files: List[MigrationFile] = []
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import operator
|
||||
import shutil
|
||||
from typing import List
|
||||
|
||||
from app_config import MIGRATION_DIR
|
||||
from db.db_setup import generate_session
|
||||
|
@ -13,7 +14,7 @@ from utils.snackbar import SnackResponse
|
|||
router = APIRouter(tags=["Migration"])
|
||||
|
||||
|
||||
@router.get("/api/migrations/", response_model=list[Migrations])
|
||||
@router.get("/api/migrations/", response_model=List[Migrations])
|
||||
def get_avaiable_nextcloud_imports():
|
||||
""" Returns a list of avaiable directories that can be imported into Mealie """
|
||||
response_data = []
|
||||
|
|
|
@ -36,17 +36,17 @@ def nextcloud_zip():
|
|||
def test_upload_nextcloud_zip(api_client, nextcloud_zip):
|
||||
|
||||
response = api_client.post(
|
||||
"/api/migration/upload/", files={"archive": nextcloud_zip.open("rb")}
|
||||
"/api/migrations/nextcloud/upload/", files={"archive": nextcloud_zip.open("rb")}
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
assert MIGRATION_DIR.joinpath(nextcloud_zip.name).is_file()
|
||||
assert MIGRATION_DIR.joinpath("nextcloud", nextcloud_zip.name).is_file()
|
||||
|
||||
|
||||
def test_import_nextcloud_directory(api_client, nextcloud_zip):
|
||||
selection = nextcloud_zip.name
|
||||
response = api_client.post(f"/api/migration/nextcloud/{selection}/import/")
|
||||
response = api_client.post(f"/api/migrations/nextcloud/{selection}/import/")
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
|
@ -60,7 +60,7 @@ def test_import_nextcloud_directory(api_client, nextcloud_zip):
|
|||
|
||||
def test_delete_migration_data(api_client, nextcloud_zip):
|
||||
selection = nextcloud_zip.name
|
||||
response = api_client.delete(f"/api/migration/{selection}/delete/")
|
||||
response = api_client.delete(f"/api/migrations/nextcloud/{selection}/delete/")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert not MIGRATION_DIR.joinpath(nextcloud_zip.name).is_file()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue