This commit is contained in:
dni ⚡
2024-09-05 12:38:59 +02:00
parent 9f60b14745
commit cd7fcd1c71
3 changed files with 18 additions and 16 deletions
-1
View File
@@ -367,7 +367,6 @@ async def test_get_payments_history(client, adminkey_headers_from, fake_payments
assert response.status_code == 200
data = response.json()
assert len(data) == 1
print(data)
assert data[0]["income"] == sum(
[int(payment.amount * 1000) for payment in fake_data if not payment.out]
)
+4 -3
View File
@@ -22,7 +22,7 @@ from lnbits.core.crud import (
from lnbits.core.models import CreateInvoice, PaymentState
from lnbits.core.services import update_wallet_balance
from lnbits.core.views.payment_api import api_payments_create_invoice
from lnbits.db import Database
from lnbits.db import DB_TYPE, SQLITE, Database
from lnbits.settings import settings
from tests.helpers import (
get_random_invoice_data,
@@ -182,7 +182,8 @@ async def invoice(to_wallet):
async def fake_payments(client, adminkey_headers_from):
# Because sqlite only stores timestamps with milliseconds
# we have to wait a second to ensure a different timestamp than previous invoices
await asyncio.sleep(1)
if DB_TYPE == SQLITE:
await asyncio.sleep(1)
ts = int(time())
fake_data = [
@@ -200,5 +201,5 @@ async def fake_payments(client, adminkey_headers_from):
assert data["checking_id"]
await update_payment_status(data["checking_id"], status=PaymentState.SUCCESS)
params = {"time[ge]": ts, "time[le]": int(time())}
params = {"time[ge]": ts, "time[le]": int(time()) + 1}
return fake_data, params