From 28d57f6317514db3bb3e352df1ee93c63eb6a6e1 Mon Sep 17 00:00:00 2001 From: Andreas Ellewsen <andreas.ellewsen@usit.uio.no> Date: Thu, 4 Mar 2021 12:07:00 +0100 Subject: [PATCH] Fix dateformats Setra expects datetime.datetime, not datetime.date In addition, voucherdate is in fact not optional. --- setra_client/models.py | 4 ++-- tests/fixtures/batch_with_voucher_fixture.json | 7 +++---- tests/fixtures/voucher_fixture.json | 1 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/setra_client/models.py b/setra_client/models.py index 195cf25..7f7727e 100644 --- a/setra_client/models.py +++ b/setra_client/models.py @@ -33,7 +33,7 @@ class BaseModel(pydantic.BaseModel): class Transaction(BaseModel): account: str amount: float - transdate: Optional[datetime.date] + transdate: Optional[datetime.datetime] curamount: Optional[float] currency: Optional[str] description: str @@ -51,7 +51,7 @@ class Transaction(BaseModel): class Voucher(BaseModel): - voucherdate: Optional[datetime.date] + voucherdate: datetime.datetime exref: Optional[str] voucherno: int transactions: typing.List[Transaction] diff --git a/tests/fixtures/batch_with_voucher_fixture.json b/tests/fixtures/batch_with_voucher_fixture.json index 97b0b95..3cda732 100644 --- a/tests/fixtures/batch_with_voucher_fixture.json +++ b/tests/fixtures/batch_with_voucher_fixture.json @@ -8,12 +8,12 @@ { "exref": 1, "voucherno": 66, + "voucherdate": "2020-10-14 00:00", "transactions": [ { - "voucherid": 66, "account": 1, "amount": 1, - "transdate": 1, + "transdate": "2020-10-14 00:00", "curamount": 1, "currency": 1, "description": 1, @@ -30,10 +30,9 @@ "extinvref": 1 }, { - "voucherid": 66, "account": 2, "amount": 2, - "transdate": 2, + "transdate": "2020-10-14 00:00", "curamount": 2, "currency": 2, "description": 2, diff --git a/tests/fixtures/voucher_fixture.json b/tests/fixtures/voucher_fixture.json index 679a9cc..a20406a 100644 --- a/tests/fixtures/voucher_fixture.json +++ b/tests/fixtures/voucher_fixture.json @@ -1,6 +1,7 @@ { "exref": 3, "voucherno": 4, + "voucherdate": "2020-10-14 00:00", "transactions": [ { "voucherid": 66, -- GitLab