fix: tests
This commit is contained in:
@@ -507,9 +507,9 @@ async def test_api_payment_without_key(invoice: Payment):
|
|||||||
|
|
||||||
# check api_payment() internal function call (NOT API): payment status
|
# check api_payment() internal function call (NOT API): payment status
|
||||||
@pytest.mark.anyio
|
@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
|
# 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 isinstance(response, dict)
|
||||||
assert response["paid"] is True
|
assert response["paid"] is True
|
||||||
assert "details" in response
|
assert "details" in response
|
||||||
|
|||||||
@@ -6,9 +6,16 @@ from lnbits.core.models.misc import SimpleStatus
|
|||||||
from lnbits.fiat.base import FiatSubscriptionResponse
|
from lnbits.fiat.base import FiatSubscriptionResponse
|
||||||
|
|
||||||
|
|
||||||
|
class _UnsetSecret:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
UNSET_SECRET = _UnsetSecret()
|
||||||
|
|
||||||
|
|
||||||
class FakeStripeWallet:
|
class FakeStripeWallet:
|
||||||
def __init__(self, secret: str | None = None):
|
def __init__(self, secret: str | None | _UnsetSecret = UNSET_SECRET):
|
||||||
self._secret = secret if secret is not None else "connection-token"
|
self._secret = "connection-token" if isinstance(secret, _UnsetSecret) else secret
|
||||||
|
|
||||||
async def create_terminal_connection_token(self) -> dict[str, str]:
|
async def create_terminal_connection_token(self) -> dict[str, str]:
|
||||||
if self._secret is None:
|
if self._secret is None:
|
||||||
|
|||||||
@@ -320,7 +320,8 @@ async def test_node_api_route_functions_with_fake_node(
|
|||||||
|
|
||||||
rank = await node_api.api_get_1ml_stats(node=node)
|
rank = await node_api.api_get_1ml_stats(node=node)
|
||||||
assert rank is not None
|
assert rank is not None
|
||||||
assert rank.channelcount == 2
|
rank_data = node_api.NodeRank.parse_obj(rank)
|
||||||
|
assert rank_data.channelcount == 2
|
||||||
finally:
|
finally:
|
||||||
settings.lnbits_node_ui_transactions = original_transactions
|
settings.lnbits_node_ui_transactions = original_transactions
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ def run_before_and_after_tests(settings: Settings):
|
|||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
async def app(settings: Settings):
|
async def app(settings: Settings):
|
||||||
app = create_app()
|
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
|
settings.first_install = True
|
||||||
await first_install(
|
await first_install(
|
||||||
UpdateSuperuserPassword(
|
UpdateSuperuserPassword(
|
||||||
|
|||||||
Reference in New Issue
Block a user