websocket internal payment notifications (#1831)

* add send_payment_notification service
payment notifications are sent from multiple places with inconsistent and incomplete data
* adopt new send_payment_notification service
* add tests
This commit is contained in:
jackstar12 2023-07-26 12:08:22 +02:00 committed by GitHub
parent cf0a87582c
commit dda6c1b3c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 65 additions and 28 deletions

View file

@ -1,6 +1,8 @@
import asyncio
import pytest
import pytest_asyncio
from fastapi.testclient import TestClient
from httpx import AsyncClient
from lnbits.app import create_app
@ -41,6 +43,11 @@ async def client(app):
await client.aclose()
@pytest.fixture(scope="session")
def test_client(app):
return TestClient(app)
@pytest_asyncio.fixture(scope="session")
async def db():
yield Database("database")
@ -63,6 +70,12 @@ async def from_wallet(from_user):
yield wallet
@pytest.fixture
def from_wallet_ws(from_wallet, test_client):
with test_client.websocket_connect(f"/api/v1/ws/{from_wallet.id}") as ws:
yield ws
@pytest_asyncio.fixture(scope="session")
async def to_user():
user = await create_account()
@ -80,6 +93,12 @@ async def to_wallet(to_user):
yield wallet
@pytest.fixture
def to_wallet_ws(to_wallet, test_client):
with test_client.websocket_connect(f"/api/v1/ws/{to_wallet.id}") as ws:
yield ws
@pytest_asyncio.fixture(scope="session")
async def inkey_headers_from(from_wallet):
wallet = from_wallet