Add category-list factory and seed categories in B4W smoke test
Tests / test (push) Successful in 23s
Tests / lint (push) Failing after 15s

This commit is contained in:
2026-10-18 09:28:19 +02:00
parent c0adc77f56
commit ea7854473f
7 changed files with 80 additions and 30 deletions
+9 -1
View File
@@ -87,13 +87,19 @@ def populated_db_b4w(
Only the first-layer ingestion table is filled; no further processing.
``**kwargs`` are forwarded to ``B4wExportFactory.build``; callable values
are resolved per row (e.g. ``ValDt=lambda: faker.date_between(...)``).
An optional ``setup`` callback runs after database creation and before rows
are inserted.
``Id1`` is reserved: it is set per row (``1..row_count``) and cannot be
overridden via ``**kwargs``.
The returned session is *not* closed by the fixture; close it in the test.
"""
def populate_db_b4w(
name: str, row_count: int = DEFAULT_B4W_ROWS, **kwargs: Any
name: str,
row_count: int = DEFAULT_B4W_ROWS,
*,
setup: Callable[[Session], None] | None = None,
**kwargs: Any,
) -> Session:
if "Id1" in kwargs:
raise ValueError(
@@ -101,6 +107,8 @@ def populated_db_b4w(
"cannot be overridden via **kwargs"
)
session = db_session_factory(name)
if setup is not None:
setup(session)
for i in range(row_count):
row_kwargs = {k: (v() if callable(v) else v) for k, v in kwargs.items()}
row = B4wExportFactory.build(Id1=i + 1, **cast(dict[str, Any], row_kwargs))