Skip to content

Commit

Permalink
add pending test
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Sep 24, 2023
1 parent b558c68 commit 60fc842
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
3 changes: 3 additions & 0 deletions cashu/lightning/fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ async def create_invoice(

async def pay_invoice(self, bolt11: str, fee_limit_msat: int) -> PaymentResponse:
invoice = decode(bolt11)
# await asyncio.sleep(5)

if invoice.payment_hash[:6] == self.privkey[:6] or BRR:
await self.queue.put(invoice)
Expand All @@ -88,6 +89,8 @@ async def pay_invoice(self, bolt11: str, fee_limit_msat: int) -> PaymentResponse
)

async def get_invoice_status(self, checking_id: str) -> PaymentStatus:
# paid = random.random() > 0.7
# return PaymentStatus(paid)
paid = checking_id in self.paid_invoices or BRR
return PaymentStatus(paid or None)

Expand Down
6 changes: 0 additions & 6 deletions tests/test_mint_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ async def test_melt(wallet1: Wallet, ledger: Ledger):

@pytest.mark.asyncio
async def test_split(wallet1: Wallet, ledger: Ledger):
# mint twice so we have enough to pay the second invoice back
invoice = await wallet1.request_mint(64)
await wallet1.mint(64, hash=invoice.hash)

Expand All @@ -55,15 +54,10 @@ async def test_split(wallet1: Wallet, ledger: Ledger):

@pytest.mark.asyncio
async def test_check_proof_state(wallet1: Wallet, ledger: Ledger):
# mint twice so we have enough to pay the second invoice back
invoice = await wallet1.request_mint(64)
await wallet1.mint(64, hash=invoice.hash)

keep_proofs, send_proofs = await wallet1.split_to_send(wallet1.proofs, 10)
secrets, rs, derivation_paths = await wallet1.generate_n_secrets(len(send_proofs))
outputs, rs = wallet1._construct_outputs(
[p.amount for p in send_proofs], secrets, rs
)

spendable, pending = await ledger.check_proof_state(proofs=send_proofs)
assert sum(spendable) == len(send_proofs)
Expand Down
5 changes: 0 additions & 5 deletions tests/test_wallet_p2pk.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,8 @@ async def test_secret_initialized_with_tags(wallet1: Wallet):
pubkey=pubkey.serialize().hex(),
tags=tags,
)
assert secret.locktime
assert secret.locktime == 100
assert secret.n_sigs
assert secret.n_sigs == 3
assert secret.sigflag
assert secret.sigflag == SigFlags.SIG_ALL


Expand All @@ -396,7 +393,5 @@ async def test_secret_initialized_with_arguments(wallet1: Wallet):
)
assert secret.locktime
assert secret.locktime > 1689000000
assert secret.n_sigs
assert secret.n_sigs == 3
assert secret.sigflag
assert secret.sigflag == SigFlags.SIG_ALL

0 comments on commit 60fc842

Please sign in to comment.