mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-21 22:57:05 +02:00
fix tests a little
This commit is contained in:
@@ -11,10 +11,11 @@ from lnbits.core.views.api import (
|
|||||||
api_payment,
|
api_payment,
|
||||||
api_payments_create_invoice,
|
api_payments_create_invoice,
|
||||||
)
|
)
|
||||||
from lnbits.settings import wallet_class
|
from lnbits.settings import get_wallet_class
|
||||||
|
|
||||||
from ...helpers import get_random_invoice_data, is_regtest
|
from ...helpers import get_random_invoice_data, is_regtest
|
||||||
|
|
||||||
|
WALLET = get_wallet_class()
|
||||||
|
|
||||||
# check if the client is working
|
# check if the client is working
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
@@ -209,7 +210,7 @@ async def test_api_payment_with_key(invoice, inkey_headers_from):
|
|||||||
|
|
||||||
# check POST /api/v1/payments: invoice creation with a description hash
|
# check POST /api/v1/payments: invoice creation with a description hash
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
wallet_class.__name__ in ["CoreLightningWallet"],
|
WALLET.__class__.__name__ in ["CoreLightningWallet"],
|
||||||
reason="wallet does not support description_hash",
|
reason="wallet does not support description_hash",
|
||||||
)
|
)
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
@@ -4,7 +4,7 @@ import secrets
|
|||||||
import string
|
import string
|
||||||
|
|
||||||
from lnbits.core.crud import create_payment
|
from lnbits.core.crud import create_payment
|
||||||
from lnbits.settings import wallet_class
|
from lnbits.settings import get_wallet_class
|
||||||
|
|
||||||
|
|
||||||
async def credit_wallet(wallet_id: str, amount: int):
|
async def credit_wallet(wallet_id: str, amount: int):
|
||||||
@@ -35,5 +35,6 @@ async def get_random_invoice_data():
|
|||||||
return {"out": False, "amount": 10, "memo": f"test_memo_{get_random_string(10)}"}
|
return {"out": False, "amount": 10, "memo": f"test_memo_{get_random_string(10)}"}
|
||||||
|
|
||||||
|
|
||||||
is_fake: bool = wallet_class.__name__ == "FakeWallet"
|
WALLET = get_wallet_class()
|
||||||
|
is_fake: bool = WALLET.__class__.__name__ == "FakeWallet"
|
||||||
is_regtest: bool = not is_fake
|
is_regtest: bool = not is_fake
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
from mock import AsyncMock
|
from mock import AsyncMock
|
||||||
|
|
||||||
from lnbits import bolt11
|
from lnbits import bolt11
|
||||||
from lnbits.settings import WALLET
|
from lnbits.settings import get_wallet_class
|
||||||
from lnbits.wallets.base import PaymentResponse, PaymentStatus, StatusResponse
|
from lnbits.wallets.base import PaymentResponse, PaymentStatus, StatusResponse
|
||||||
from lnbits.wallets.fake import FakeWallet
|
from lnbits.wallets.fake import FakeWallet
|
||||||
|
|
||||||
from .helpers import get_random_string, is_fake
|
from .helpers import get_random_string, is_fake
|
||||||
|
|
||||||
|
WALLET = get_wallet_class()
|
||||||
|
|
||||||
# generates an invoice with FakeWallet
|
# generates an invoice with FakeWallet
|
||||||
async def generate_mock_invoice(**x):
|
async def generate_mock_invoice(**x):
|
||||||
|
Reference in New Issue
Block a user