[FEAT] improve update_admin_settings (#1903)
* [FEAT] improve update_admin_settings while working on the push notification pr i found it very hard just to update 2 settings inside the db, so i improved upon update_admin_settings. now you just need to provide a dict with key/values you want to update inside db. also debugging the endpoints for update_settings i found despite the type of `EditableSettings` fastapi did in fact pass a dict. * t * use `EditableSettings` as param in update_settings * fix settings model validation we previously overrode the pydantic validation with our own method * make `LnbitsSettings` a `BaseModel` and only add `BaseSettings` later this allows us to instantiate `EditableSettings` without the environment values being loaded in * add test * forbid extra fields in update api * fixup * add test * test datadir * move UpdateSettings * fix compat * fixup webpush --------- Co-authored-by: jacksn <jkranawetter05@gmail.com>
This commit is contained in:
parent
1b2db34e08
commit
bda054415a
6 changed files with 76 additions and 25 deletions
|
|
@ -10,7 +10,7 @@ from fastapi.testclient import TestClient
|
|||
from httpx import AsyncClient
|
||||
|
||||
from lnbits.app import create_app
|
||||
from lnbits.core.crud import create_account, create_wallet
|
||||
from lnbits.core.crud import create_account, create_wallet, get_user
|
||||
from lnbits.core.models import CreateInvoice
|
||||
from lnbits.core.services import update_wallet_balance
|
||||
from lnbits.core.views.api import api_payments_create_invoice
|
||||
|
|
@ -18,7 +18,10 @@ from lnbits.db import Database
|
|||
from lnbits.settings import settings
|
||||
from tests.helpers import get_hold_invoice, get_random_invoice_data, get_real_invoice
|
||||
|
||||
# dont install extensions for tests
|
||||
# override settings for tests
|
||||
settings.lnbits_admin_extensions = []
|
||||
settings.lnbits_data_folder = "./tests/data"
|
||||
settings.lnbits_admin_ui = True
|
||||
settings.lnbits_extensions_default_install = []
|
||||
|
||||
|
||||
|
|
@ -86,6 +89,12 @@ async def to_user():
|
|||
yield user
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="session")
|
||||
async def superuser():
|
||||
user = await get_user(settings.super_user)
|
||||
yield user
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="session")
|
||||
async def to_wallet(to_user):
|
||||
user = to_user
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue