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:
calle
2022-07-07 18:29:26 +02:00
committed by GitHub
parent 262bd32f44
commit 63d4e60542
12 changed files with 91 additions and 45 deletions
+7 -2
View File
@@ -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
View File
@@ -1,4 +1,5 @@
import pytest
import pytest_asyncio
from tests.conftest import client
+1
View File
@@ -1,4 +1,5 @@
import pytest
import pytest_asyncio
from lnbits.core.crud import get_wallet
# check if the client is working