chore: update to latest pytest (#2800)

This commit is contained in:
dni ⚡ 2024-12-11 10:39:28 +01:00 committed by GitHub
parent 8ff4962e86
commit 291c69e470
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 303 additions and 310 deletions

View file

@ -22,8 +22,8 @@ from lnbits.wallets.base import PaymentResponse
from lnbits.wallets.fake import FakeWallet
@pytest.mark.asyncio
async def test_invalid_bolt11(to_wallet):
@pytest.mark.anyio
async def test_invalid_bolt11(to_wallet: Wallet):
with pytest.raises(PaymentError):
await pay_invoice(
wallet_id=to_wallet.id,
@ -31,7 +31,7 @@ async def test_invalid_bolt11(to_wallet):
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_amountless_invoice(to_wallet: Wallet):
zero_amount_invoice = (
"lnbc1pnsu5z3pp57getmdaxhg5kc9yh2a2qsh7cjf4gnccgkw0qenm8vsqv50w7s"
@ -47,7 +47,7 @@ async def test_amountless_invoice(to_wallet: Wallet):
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_bad_wallet_id(to_wallet: Wallet):
payment = await create_invoice(wallet_id=to_wallet.id, amount=31, memo="Bad Wallet")
bad_wallet_id = to_wallet.id[::-1]
@ -60,11 +60,10 @@ async def test_bad_wallet_id(to_wallet: Wallet):
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_payment_limit(to_wallet: Wallet):
payment = await create_invoice(wallet_id=to_wallet.id, amount=101, memo="")
with pytest.raises(PaymentError, match="Amount in invoice is too high."):
await pay_invoice(
wallet_id=to_wallet.id,
max_sat=100,
@ -72,7 +71,7 @@ async def test_payment_limit(to_wallet: Wallet):
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_pay_twice(to_wallet: Wallet):
payment = await create_invoice(wallet_id=to_wallet.id, amount=3, memo="Twice")
await pay_invoice(
@ -86,7 +85,7 @@ async def test_pay_twice(to_wallet: Wallet):
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_fake_wallet_pay_external(
to_wallet: Wallet, external_funding_source: FakeWallet
):
@ -101,7 +100,7 @@ async def test_fake_wallet_pay_external(
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_invoice_changed(to_wallet: Wallet):
payment = await create_invoice(wallet_id=to_wallet.id, amount=21, memo="original")
@ -126,7 +125,7 @@ async def test_invoice_changed(to_wallet: Wallet):
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_pay_for_extension(to_wallet: Wallet, settings: Settings):
payment = await create_invoice(wallet_id=to_wallet.id, amount=3, memo="Allowed")
await pay_invoice(
@ -144,7 +143,7 @@ async def test_pay_for_extension(to_wallet: Wallet, settings: Settings):
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_notification_for_internal_payment(to_wallet: Wallet):
test_name = "test_notification_for_internal_payment"
@ -168,7 +167,7 @@ async def test_notification_for_internal_payment(to_wallet: Wallet):
break # we found our payment, success
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_pay_failed(
to_wallet: Wallet, mocker: MockerFixture, external_funding_source: FakeWallet
):
@ -194,7 +193,7 @@ async def test_pay_failed(
assert payment.amount == -2101_000
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_retry_failed_invoice(
from_wallet: Wallet, mocker: MockerFixture, external_funding_source: FakeWallet
):
@ -264,7 +263,7 @@ async def test_retry_failed_invoice(
assert ws_notification.call_count == 0, "Websocket notification not sent."
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_pay_external_invoice_pending(
from_wallet: Wallet, mocker: MockerFixture, external_funding_source: FakeWallet
):
@ -310,7 +309,7 @@ async def test_pay_external_invoice_pending(
assert ws_notification.call_count == 0, "Websocket notification not sent."
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_retry_pay_external_invoice_pending(
from_wallet: Wallet, mocker: MockerFixture, external_funding_source: FakeWallet
):
@ -355,7 +354,7 @@ async def test_retry_pay_external_invoice_pending(
assert ws_notification.call_count == 0, "Websocket notification not sent."
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_pay_external_invoice_success(
from_wallet: Wallet, mocker: MockerFixture, external_funding_source: FakeWallet
):
@ -401,7 +400,7 @@ async def test_pay_external_invoice_success(
assert ws_notification.call_count == 1, "Websocket notification sent."
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_retry_pay_success(
from_wallet: Wallet, mocker: MockerFixture, external_funding_source: FakeWallet
):
@ -446,7 +445,7 @@ async def test_retry_pay_success(
assert ws_notification.call_count == 1, "No new websocket notification sent."
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_pay_external_invoice_success_bad_checking_id(
from_wallet: Wallet, mocker: MockerFixture, external_funding_source: FakeWallet
):
@ -479,7 +478,7 @@ async def test_pay_external_invoice_success_bad_checking_id(
assert payment.status == PaymentState.SUCCESS.value
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_no_checking_id(
from_wallet: Wallet, mocker: MockerFixture, external_funding_source: FakeWallet
):
@ -512,7 +511,7 @@ async def test_no_checking_id(
assert payment.status == PaymentState.PENDING.value
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_service_fee(
from_wallet: Wallet,
to_wallet: Wallet,
@ -552,7 +551,7 @@ async def test_service_fee(
assert _payment.preimage == preimage
service_fee_payment = await get_standalone_payment(
f"service_fee_{payment.payment_hash}"
f"service_fee_{payment.payment_hash}",
)
assert service_fee_payment
assert service_fee_payment.status == PaymentState.SUCCESS.value