TEST: fix tests for real wallets (#1761)
* fix tests for real wallets * change realinvoice provider to lnd-1 * use lnd-3 for tests * fix eclair tests * use bullseye in dockerimage
This commit is contained in:
parent
8ed2422ade
commit
c48e2329c5
5 changed files with 22 additions and 20 deletions
|
|
@ -127,6 +127,6 @@ async def invoice(to_wallet):
|
|||
|
||||
@pytest_asyncio.fixture(scope="session")
|
||||
async def real_invoice():
|
||||
invoice = get_real_invoice(100_000, "test-fixture")
|
||||
yield invoice
|
||||
invoice = get_real_invoice(100)
|
||||
yield {"bolt11": invoice["payment_request"]}
|
||||
del invoice
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@ import json
|
|||
import random
|
||||
import secrets
|
||||
import string
|
||||
import time
|
||||
from subprocess import PIPE, Popen, run
|
||||
|
||||
from lnbits.core.crud import create_payment
|
||||
from lnbits.settings import get_wallet_class
|
||||
from lnbits.settings import get_wallet_class, set_wallet_class
|
||||
|
||||
|
||||
async def credit_wallet(wallet_id: str, amount: int):
|
||||
|
|
@ -38,6 +37,7 @@ async def get_random_invoice_data():
|
|||
return {"out": False, "amount": 10, "memo": f"test_memo_{get_random_string(10)}"}
|
||||
|
||||
|
||||
set_wallet_class()
|
||||
WALLET = get_wallet_class()
|
||||
is_fake: bool = WALLET.__class__.__name__ == "FakeWallet"
|
||||
is_regtest: bool = not is_fake
|
||||
|
|
@ -47,8 +47,8 @@ docker_bitcoin_rpc = "lnbits"
|
|||
docker_prefix = "lnbits-legend"
|
||||
docker_cmd = "docker exec"
|
||||
|
||||
docker_lightning = f"{docker_cmd} {docker_prefix}-clightning-2-1"
|
||||
docker_lightning_cli = f"{docker_lightning} lightning-cli --network regtest"
|
||||
docker_lightning = f"{docker_cmd} {docker_prefix}-lnd-1-1"
|
||||
docker_lightning_cli = f"{docker_lightning} lncli --network regtest --rpcserver=lnd-1"
|
||||
|
||||
docker_bitcoin = f"{docker_cmd} {docker_prefix}-bitcoind-1-1"
|
||||
docker_bitcoin_cli = f"{docker_bitcoin} bitcoin-cli -rpcuser={docker_bitcoin_rpc} -rpcpassword={docker_bitcoin_rpc} -regtest"
|
||||
|
|
@ -62,16 +62,17 @@ def run_cmd_json(cmd: str) -> dict:
|
|||
return json.loads(run_cmd(cmd))
|
||||
|
||||
|
||||
def get_real_invoice(sats: int, prefix: str, description: str = "test") -> dict:
|
||||
def get_real_invoice(sats: int) -> dict:
|
||||
msats = sats * 1000
|
||||
return run_cmd_json(
|
||||
f"{docker_lightning_cli} invoice {msats} {prefix}-{time.time()} {description}"
|
||||
)
|
||||
return run_cmd_json(f"{docker_lightning_cli} addinvoice {msats}")
|
||||
|
||||
|
||||
def pay_real_invoice(invoice: str) -> Popen:
|
||||
return Popen(
|
||||
f"{docker_lightning_cli} pay {invoice}", shell=True, stdin=PIPE, stdout=PIPE
|
||||
f"{docker_lightning_cli} payinvoice {invoice}",
|
||||
shell=True,
|
||||
stdin=PIPE,
|
||||
stdout=PIPE,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue