mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-26 15:42:30 +01:00
28 lines
581 B
Python
28 lines
581 B
Python
|
import pytest
|
||
|
from pydantic import BaseModel
|
||
|
|
||
|
from lnbits.helpers import (
|
||
|
insert_query,
|
||
|
update_query,
|
||
|
)
|
||
|
|
||
|
|
||
|
class TestModel(BaseModel):
|
||
|
id: int
|
||
|
name: str
|
||
|
|
||
|
|
||
|
test = TestModel(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 = ?"
|