Skip to content

Commit

Permalink
fix api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Nov 1, 2024
1 parent 2bdb3ed commit 60dce8c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cashu/wallet/api/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def create_invoice(
response_model=PaymentStatus,
)
async def invoice_state(
payment_hash: str = Query(default=None, description="Payment hash of paid invoice"),
payment_request: str = Query(default=None, description="Payment request to check"),
mint: str = Query(
default=None,
description="Mint URL to create an invoice at (None for default mint)",
Expand All @@ -154,7 +154,7 @@ async def invoice_state(
global wallet
if mint:
wallet = await mint_wallet(mint)
state = await wallet.get_invoice_status(payment_hash)
state = await wallet.get_invoice_status(payment_request)
return state


Expand Down
2 changes: 0 additions & 2 deletions tests/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,8 @@ async def test_melt(wallet1: Wallet):
assert wallet1.balance == 128

invoice_payment_request = ""
invoice_payment_hash = ""
if is_regtest:
invoice_dict = get_real_invoice(64)
invoice_payment_hash = str(invoice_dict["r_hash"])
invoice_payment_request = invoice_dict["payment_request"]

if is_fake:
Expand Down
6 changes: 4 additions & 2 deletions tests/test_wallet_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ async def test_invoice(wallet: Wallet):
while state.pending:
print("checking invoice state")
response2 = client.get(
f"/lightning/invoice_state?payment_hash={invoice_response.checking_id}"
f"/lightning/invoice_state?payment_request={invoice_response.payment_request}"
)
state = PaymentStatus.parse_obj(response2.json())
await asyncio.sleep(0.1)
print("state:", state)
print("paid")
await wallet.load_proofs()
assert wallet.available_balance == 100


@pytest.mark.skipif(is_regtest, reason="regtest")
Expand Down Expand Up @@ -175,7 +177,7 @@ async def test_flow(wallet: Wallet):
while state.pending:
print("checking invoice state")
response2 = client.get(
f"/lightning/invoice_state?payment_hash={invoice_response.checking_id}"
f"/lightning/invoice_state?payment_request={invoice_response.payment_request}"
)
state = PaymentStatus.parse_obj(response2.json())
await asyncio.sleep(0.1)
Expand Down

0 comments on commit 60dce8c

Please sign in to comment.