b4w data factories and tests
This commit is contained in:
+3
-6
@@ -1,13 +1,10 @@
|
||||
#!/bin/python
|
||||
from collections.abc import Callable
|
||||
|
||||
from polyfactory.factories.pydantic_factory import ModelFactory
|
||||
|
||||
from src.models import B4wExport
|
||||
|
||||
CATEGORIES = [
|
||||
"single_category",
|
||||
"root_category:parent_category:leaf_category",
|
||||
]
|
||||
DEFAULT_CATEGORY = "root_category:parent_category:leaf_category"
|
||||
|
||||
class B4wExportFactory(ModelFactory[B4wExport]):
|
||||
__model__ = B4wExport
|
||||
...
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
from src.models import B4wExport, Category
|
||||
from tests.factories import B4wExportFactory
|
||||
|
||||
def test_b4wexport_simple():
|
||||
data = B4wExportFactory.build()
|
||||
assert isinstance(data, B4wExport)
|
||||
|
||||
|
||||
def test_b4export_category():
|
||||
data = B4wExportFactory.build(Category="fun:stuff")
|
||||
assert isinstance(data.category, Category)
|
||||
assert data.category.to_str() == "fun:stuff"
|
||||
Reference in New Issue
Block a user