mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 22:43:34 -07:00
general cleanup
This commit is contained in:
parent
223c198e83
commit
8e0e516108
4 changed files with 29 additions and 8 deletions
|
@ -33,10 +33,10 @@ class ImportJob(BackupOptions):
|
||||||
"example": {
|
"example": {
|
||||||
"name": "my_local_backup.zip",
|
"name": "my_local_backup.zip",
|
||||||
"recipes": True,
|
"recipes": True,
|
||||||
"force": False,
|
"settings": True,
|
||||||
"rebase": False,
|
"themes": True,
|
||||||
"themes": False,
|
"groups": True,
|
||||||
"settings": False,
|
"users": True,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,9 @@ import requests
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
from mealie.app import app
|
from mealie.app import app
|
||||||
from mealie.core.config import SQLITE_DIR
|
from mealie.core.config import SQLITE_DIR
|
||||||
from mealie.db.database import db
|
|
||||||
from mealie.db.db_setup import generate_session, sql_global_init
|
from mealie.db.db_setup import generate_session, sql_global_init
|
||||||
from mealie.db.init_db import init_db
|
from mealie.db.init_db import init_db
|
||||||
from mealie.routes.deps import get_current_user
|
|
||||||
from mealie.schema.user import UserInDB
|
|
||||||
from pytest import fixture
|
from pytest import fixture
|
||||||
from sqlalchemy.orm.session import Session
|
|
||||||
|
|
||||||
from tests.test_config import TEST_DATA
|
from tests.test_config import TEST_DATA
|
||||||
|
|
||||||
|
|
25
tests/test_routes/test_import_routes.py
Normal file
25
tests/test_routes/test_import_routes.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import json
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def backup_data():
|
||||||
|
return {
|
||||||
|
"name": "dev_sample_data_2021-Feb-13.zip",
|
||||||
|
"force": False,
|
||||||
|
"recipes": True,
|
||||||
|
"settings": False, #! Broken
|
||||||
|
"themes": True,
|
||||||
|
"groups": True,
|
||||||
|
"users": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_import(api_client, backup_data):
|
||||||
|
response = api_client.post("/api/backups/dev_sample_data_2021-Feb-13.zip/import", json=backup_data)
|
||||||
|
|
||||||
|
assert response.status_code == 200
|
||||||
|
for key, value in json.loads(response.content).items():
|
||||||
|
for v in value:
|
||||||
|
assert v["status"] == True
|
Loading…
Add table
Add a link
Reference in a new issue