remove pyproject artifacts
import conv fix postgres url fix migration fixup timestamp postgresql fixup more timestamp fix migrations fix migrations fix statement add psycopg2 for conv tests expiry timestamp flaku fix expiry more wait parse to int remove time from filters
This commit is contained in:
@@ -368,10 +368,10 @@ async def test_get_payments_history(client, adminkey_headers_from, fake_payments
|
||||
data = response.json()
|
||||
assert len(data) == 1
|
||||
assert data[0]["spending"] == sum(
|
||||
payment.amount * 1000 for payment in fake_data if payment.out
|
||||
int(payment.amount * 1000) for payment in fake_data if payment.out
|
||||
)
|
||||
assert data[0]["income"] == sum(
|
||||
payment.amount * 1000 for payment in fake_data if not payment.out
|
||||
int(payment.amount * 1000) for payment in fake_data if not payment.out
|
||||
)
|
||||
|
||||
response = await client.get(
|
||||
|
||||
+7
-8
@@ -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 DB_TYPE, SQLITE, Database
|
||||
from lnbits.db import Database
|
||||
from lnbits.settings import settings
|
||||
from tests.helpers import (
|
||||
get_random_invoice_data,
|
||||
@@ -182,9 +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
|
||||
if DB_TYPE == SQLITE:
|
||||
await asyncio.sleep(1)
|
||||
ts = time()
|
||||
await asyncio.sleep(1)
|
||||
ts = int(time())
|
||||
|
||||
fake_data = [
|
||||
CreateInvoice(amount=10, memo="aaaa", out=False),
|
||||
@@ -197,9 +196,9 @@ async def fake_payments(client, adminkey_headers_from):
|
||||
"/api/v1/payments", headers=adminkey_headers_from, json=invoice.dict()
|
||||
)
|
||||
assert response.is_success
|
||||
await update_payment_status(
|
||||
response.json()["checking_id"], status=PaymentState.SUCCESS
|
||||
)
|
||||
data = response.json()
|
||||
assert data["checking_id"]
|
||||
await update_payment_status(data["checking_id"], status=PaymentState.SUCCESS)
|
||||
|
||||
params = {"time[ge]": ts, "time[le]": time()}
|
||||
params = {"time[ge]": ts, "time[le]": int(time())}
|
||||
return fake_data, params
|
||||
|
||||
@@ -14,8 +14,8 @@ from lnbits.db import POSTGRES
|
||||
@pytest.mark.asyncio
|
||||
async def test_date_conversion(db):
|
||||
if db.type == POSTGRES:
|
||||
row = await db.fetchone("SELECT now()::date")
|
||||
assert row and isinstance(row[0], date)
|
||||
row = await db.fetchone("SELECT now()::date as now")
|
||||
assert row and isinstance(row.get("now"), date)
|
||||
|
||||
|
||||
# make test to create wallet and delete wallet
|
||||
|
||||
Reference in New Issue
Block a user