chore: adhere to ruff's "N" rules (#2377)

* chore: adhere to ruff's "N" rules

WARN: reinstall failing extensions!

bunch of more consistent variable naming. inspired by this issue.
https://github.com/lnbits/lnbits/issues/2308

* fixup! chore: adhere to ruff's "N" rules
* rename to funding_source
* skip jmeter

---------

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
This commit is contained in:
dni ⚡
2024-04-15 09:02:21 +02:00
committed by GitHub
co-authored by Pavol Rusnak
parent 055426ab53
commit 6d5ad9e229
28 changed files with 191 additions and 173 deletions
+11 -10
View File
@@ -10,7 +10,7 @@ from lnbits.core.services import fee_reserve_total
from lnbits.core.views.admin_api import api_auditor
from lnbits.core.views.payment_api import api_payment
from lnbits.settings import settings
from lnbits.wallets import get_wallet_class
from lnbits.wallets import get_funding_source
from ...helpers import (
cancel_invoice,
@@ -22,7 +22,7 @@ from ...helpers import (
settle_invoice,
)
WALLET = get_wallet_class()
funding_source = get_funding_source()
# create account POST /api/v1/account
@@ -407,7 +407,8 @@ async def test_api_payment_with_key(invoice, inkey_headers_from):
# check POST /api/v1/payments: invoice creation with a description hash
@pytest.mark.skipif(
WALLET.__class__.__name__ in ["CoreLightningWallet", "CoreLightningRestWallet"],
funding_source.__class__.__name__
in ["CoreLightningWallet", "CoreLightningRestWallet"],
reason="wallet does not support description_hash",
)
@pytest.mark.asyncio
@@ -428,7 +429,7 @@ async def test_create_invoice_with_description_hash(client, inkey_headers_to):
@pytest.mark.skipif(
WALLET.__class__.__name__ in ["CoreLightningRestWallet"],
funding_source.__class__.__name__ in ["CoreLightningRestWallet"],
reason="wallet does not support unhashed_description",
)
@pytest.mark.asyncio
@@ -540,8 +541,8 @@ async def test_pay_real_invoice(
payment_status = response.json()
assert payment_status["paid"]
WALLET = get_wallet_class()
status = await WALLET.get_payment_status(invoice["payment_hash"])
funding_source = get_funding_source()
status = await funding_source.get_payment_status(invoice["payment_hash"])
assert status.paid
await asyncio.sleep(1)
@@ -571,7 +572,7 @@ async def test_create_real_invoice(client, adminkey_headers_from, inkey_headers_
async def listen():
found_checking_id = False
async for checking_id in get_wallet_class().paid_invoices_stream():
async for checking_id in get_funding_source().paid_invoices_stream():
if checking_id == invoice["checking_id"]:
found_checking_id = True
return
@@ -622,8 +623,8 @@ async def test_pay_real_invoice_set_pending_and_check_state(
assert response["paid"]
# make sure that the backend also thinks it's paid
WALLET = get_wallet_class()
status = await WALLET.get_payment_status(invoice["payment_hash"])
funding_source = get_funding_source()
status = await funding_source.get_payment_status(invoice["payment_hash"])
assert status.paid
# get the outgoing payment from the db
@@ -800,7 +801,7 @@ async def test_receive_real_invoice_set_pending_and_check_state(
async def listen():
found_checking_id = False
async for checking_id in get_wallet_class().paid_invoices_stream():
async for checking_id in get_funding_source().paid_invoices_stream():
if checking_id == invoice["checking_id"]:
found_checking_id = True
return
+3 -2
View File
@@ -10,14 +10,15 @@ from lnbits.nodes.base import ChannelPoint, ChannelState, NodeChannel
from tests.conftest import pytest_asyncio, settings
from ...helpers import (
WALLET,
funding_source,
get_random_invoice_data,
get_unconnected_node_uri,
mine_blocks,
)
pytestmark = pytest.mark.skipif(
WALLET.__node_cls__ is None, reason="Cant test if node implementation isnt avilable"
funding_source.__node_cls__ is None,
reason="Cant test if node implementation isnt available",
)