test: ensure we read expected data from database

This commit is contained in:
bronsen 2026-02-22 18:08:39 +01:00
parent d712c7eead
commit d205f4909e
3 changed files with 86 additions and 11 deletions

View file

@ -12,7 +12,7 @@ from textual.screen import Screen
from textual.widget import Widget
from textual.widgets import Button, DataTable, Footer, Header, Input, Static
from .database import create_db_and_tables
from .database import create_db_and_tables, engine
from .models import add_to_database, load_initial_data, make_teilchen_input
logging.basicConfig(
@ -68,7 +68,7 @@ class SearchBar(Static):
event.input.value = ""
teilchen = await add_to_database(tc)
teilchen = await add_to_database(tc, engine)
self.screen.query_one(DataTable).add_row(
teilchen.id, teilchen.name, teilchen.description, teilchen.number, teilchen.tags
)
@ -81,7 +81,7 @@ class SearchResults(Widget):
async def on_mount(self) -> None:
table: DataTable = self.query_one(DataTable)
table.add_columns(*TEILCHEN_DATA_HEADER)
table.add_rows(await load_initial_data())
table.add_rows(await load_initial_data(engine))
class AddInventoryScreen(Screen):