This commit is contained in:
dni ⚡
2024-10-17 10:37:13 +02:00
parent 4e3c19f277
commit be72e35914
4 changed files with 61 additions and 97 deletions
+14 -8
View File
@@ -9,6 +9,8 @@ from lnbits.wallets.fake import FakeWallet
uvloop.install()
from uuid import uuid4
import pytest
import pytest_asyncio
from fastapi.testclient import TestClient
@@ -18,13 +20,13 @@ from lnbits.app import create_app
from lnbits.core.crud import (
create_account,
create_wallet,
get_account_by_username,
get_account,
get_account_by_username,
get_user,
update_payment_status,
)
from lnbits.core.models import CreateInvoice, PaymentState
from lnbits.core.services import create_user_account, update_wallet_balance
from lnbits.core.models import Account, CreateInvoice, PaymentState
from lnbits.core.services import update_wallet_balance
from lnbits.core.views.payment_api import api_payments_create_invoice
from lnbits.db import DB_TYPE, SQLITE, Database
from lnbits.settings import AuthMethods, settings
@@ -102,12 +104,16 @@ async def db():
@pytest_asyncio.fixture(scope="package")
async def user_alan():
user = await get_account_by_username("alan")
if not user:
user = await create_user_account(
email="alan@lnbits.com", username="alan", password="secret1234"
account = await get_account_by_username("alan")
if not account:
account = Account(
id=uuid4().hex,
email="alan@lnbits.com",
username="alan",
)
yield user
account.hash_password("secret1234")
await create_account(account)
yield account
@pytest_asyncio.fixture(scope="session")