lnbits-legend/tests/core/test_helpers_query.py
dni ⚡ 3ef1941fc0
test: fix TestModel warning (#2317)
PytestCollectionWarning: cannot collect test class 'TestModel' because it has a __init__ constructor (from: tests/core/test_helpers_query.py)
2024-03-12 11:32:10 +01:00

27 lines
585 B
Python

import pytest
from pydantic import BaseModel
from lnbits.helpers import (
insert_query,
update_query,
)
class DbTestModel(BaseModel):
id: int
name: str
test = DbTestModel(id=1, name="test")
@pytest.mark.asyncio
async def test_helpers_insert_query():
q = insert_query("test_helpers_query", test)
assert q == "INSERT INTO test_helpers_query (id, name) VALUES (?, ?)"
@pytest.mark.asyncio
async def test_helpers_update_query():
q = update_query("test_helpers_query", test)
assert q == "UPDATE test_helpers_query SET id = ?, name = ? WHERE id = ?"