[TEST] use clean db in postgres tests (#1928)

This commit is contained in:
jackstar12 2023-09-12 12:02:01 +02:00 committed by GitHub
parent bda054415a
commit c29e7a1759
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 2 deletions

View file

@ -2,7 +2,7 @@ import asyncio
import uvloop
uvloop.install() # noqa
uvloop.install()
import pytest
import pytest_asyncio
@ -16,7 +16,12 @@ from lnbits.core.services import update_wallet_balance
from lnbits.core.views.api import api_payments_create_invoice
from lnbits.db import Database
from lnbits.settings import settings
from tests.helpers import get_hold_invoice, get_random_invoice_data, get_real_invoice
from tests.helpers import (
clean_database,
get_hold_invoice,
get_random_invoice_data,
get_real_invoice,
)
# override settings for tests
settings.lnbits_admin_extensions = []
@ -35,6 +40,7 @@ def event_loop():
# use session scope to run once before and once after all tests
@pytest_asyncio.fixture(scope="session")
async def app():
clean_database(settings)
app = create_app()
await app.router.startup()
yield app