mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-26 07:31:22 +01:00
PytestCollectionWarning: cannot collect test class 'TestModel' because it has a __init__ constructor (from: tests/core/test_helpers_query.py)
27 lines
585 B
Python
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 = ?"
|