mirror of
https://github.com/lnbits/lnbits.git
synced 2025-12-10 04:32:29 +01:00
Automated tests (#566)
* return error for wrong key * payment check use key dependency * more expressive error * re-add optional key * more tests * more * more granular * more testing * custom event_loop * tests work * fix lots of mypy errors * test_public_api * both files * remove unused import * tests * tests working * rm empty file * minimal test * set FAKE_WALLET_SECRET="ToTheMoon1" * set FAKE_WALLET_SECRET="ToTheMoon1" * trial and error * trial and error * test postgres * test postgres * test postgres * test postgres * test postgres * test postgres * test build * skip mypy
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import hashlib
|
||||
import secrets
|
||||
import random
|
||||
import string
|
||||
from lnbits.core.crud import create_payment
|
||||
|
||||
|
||||
@@ -14,7 +16,18 @@ async def credit_wallet(wallet_id: str, amount: int):
|
||||
payment_hash=payment_hash,
|
||||
checking_id=payment_hash,
|
||||
preimage=preimage,
|
||||
memo="",
|
||||
memo=f"funding_test_{get_random_string(5)}",
|
||||
amount=amount, # msat
|
||||
pending=False, # not pending, so it will increase the wallet's balance
|
||||
)
|
||||
|
||||
|
||||
def get_random_string(N=10):
|
||||
return "".join(
|
||||
random.SystemRandom().choice(string.ascii_uppercase + string.digits)
|
||||
for _ in range(10)
|
||||
)
|
||||
|
||||
|
||||
async def get_random_invoice_data():
|
||||
return {"out": False, "amount": 10, "memo": f"test_memo_{get_random_string(10)}"}
|
||||
|
||||
Reference in New Issue
Block a user