32 lines
902 B
Python
32 lines
902 B
Python
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from src.models import B4wExport, Category
|
|
from tests.factories import B4wExportFactory
|
|
|
|
|
|
def test_b4w_export_simple():
|
|
data = B4wExportFactory.build()
|
|
assert isinstance(data, B4wExport)
|
|
|
|
|
|
def test_b4w_export_category():
|
|
data = B4wExportFactory.build(Category="fun:stuff")
|
|
assert isinstance(data.category, Category)
|
|
assert data.category.to_str() == "fun:stuff"
|
|
|
|
|
|
def test_b4w_export_account_iban_invalid():
|
|
with pytest.raises(ValidationError):
|
|
_ = B4wExportFactory.build(OwnrAcctIBAN="not an IBAN")
|
|
|
|
|
|
def test_b4w_export_account_iban_to_long():
|
|
with pytest.raises(ValidationError):
|
|
_ = B4wExportFactory.build(OwnrAcctIBAN="DE990123456789012345678901234567890")
|
|
|
|
|
|
def test_b4w_export_account_iban_to_short():
|
|
with pytest.raises(ValidationError):
|
|
_ = B4wExportFactory.build(OwnrAcctIBAN="DE123")
|