fix: tests

This commit is contained in:
Vlad Stan
2026-03-25 10:49:52 +02:00
parent 1df9fa831d
commit 9fcf3121ac
4 changed files with 14 additions and 6 deletions
+2 -2
View File
@@ -507,9 +507,9 @@ async def test_api_payment_without_key(invoice: Payment):
# check api_payment() internal function call (NOT API): payment status
@pytest.mark.anyio
async def test_api_payment_with_key(invoice: Payment, inkey_headers_from):
async def test_api_payment_with_key(invoice: Payment, inkey_headers_to):
# check the payment status
response = await api_payment(invoice.payment_hash, inkey_headers_from["X-Api-Key"])
response = await api_payment(invoice.payment_hash, inkey_headers_to["X-Api-Key"])
assert isinstance(response, dict)
assert response["paid"] is True
assert "details" in response
+9 -2
View File
@@ -6,9 +6,16 @@ from lnbits.core.models.misc import SimpleStatus
from lnbits.fiat.base import FiatSubscriptionResponse
class _UnsetSecret:
pass
UNSET_SECRET = _UnsetSecret()
class FakeStripeWallet:
def __init__(self, secret: str | None = None):
self._secret = secret if secret is not None else "connection-token"
def __init__(self, secret: str | None | _UnsetSecret = UNSET_SECRET):
self._secret = "connection-token" if isinstance(secret, _UnsetSecret) else secret
async def create_terminal_connection_token(self) -> dict[str, str]:
if self._secret is None:
+2 -1
View File
@@ -320,7 +320,8 @@ async def test_node_api_route_functions_with_fake_node(
rank = await node_api.api_get_1ml_stats(node=node)
assert rank is not None
assert rank.channelcount == 2
rank_data = node_api.NodeRank.parse_obj(rank)
assert rank_data.channelcount == 2
finally:
settings.lnbits_node_ui_transactions = original_transactions
+1 -1
View File
@@ -66,7 +66,7 @@ def run_before_and_after_tests(settings: Settings):
@pytest.fixture(scope="session")
async def app(settings: Settings):
app = create_app()
async with LifespanManager(app) as manager:
async with LifespanManager(app, startup_timeout=15, shutdown_timeout=15) as manager:
settings.first_install = True
await first_install(
UpdateSuperuserPassword(