diff --git a/tests/api/test_api.py b/tests/api/test_api.py index a8b80dcfe..2e111360f 100644 --- a/tests/api/test_api.py +++ b/tests/api/test_api.py @@ -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 diff --git a/tests/api/test_fiat_api.py b/tests/api/test_fiat_api.py index 03cdd2143..b7a2a8d9b 100644 --- a/tests/api/test_fiat_api.py +++ b/tests/api/test_fiat_api.py @@ -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: diff --git a/tests/api/test_node_api.py b/tests/api/test_node_api.py index 9e163d278..158c2db14 100644 --- a/tests/api/test_node_api.py +++ b/tests/api/test_node_api.py @@ -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 diff --git a/tests/conftest.py b/tests/conftest.py index 6db84adcc..50cfeb009 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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(