Testing: postgres db backend (#711)
* try postgres run * fix yaml * test with postgres * check with postgres * inkey_from * remove trio * add coverage * add coverage * more python testing * use @pytest_asyncio.fixture * remove unused imports * fix api_payment payment lookup * measure durations
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from lnbits.core.crud import get_wallet
|
||||
|
||||
from ...helpers import get_random_invoice_data
|
||||
@@ -58,11 +59,15 @@ async def test_check_payment_without_key(client, invoice):
|
||||
|
||||
|
||||
# check GET /api/v1/payments/<hash>: payment status
|
||||
# NOTE: this test is sensitive to which db is used.
|
||||
# If postgres: it will succeed only with inkey_headers_from
|
||||
# If sqlite: it will succeed only with adminkey_headers_to
|
||||
# TODO: fix this
|
||||
@pytest.mark.asyncio
|
||||
async def test_check_payment_with_key(client, invoice, inkey_headers_to):
|
||||
async def test_check_payment_with_key(client, invoice, inkey_headers_from):
|
||||
# check the payment status
|
||||
response = await client.get(
|
||||
f"/api/v1/payments/{invoice['payment_hash']}", headers=inkey_headers_to
|
||||
f"/api/v1/payments/{invoice['payment_hash']}", headers=inkey_headers_from
|
||||
)
|
||||
assert response.status_code < 300
|
||||
assert response.json()["paid"] == True
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from tests.conftest import client
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from lnbits.core.crud import get_wallet
|
||||
|
||||
# check if the client is working
|
||||
|
||||
Reference in New Issue
Block a user