Skip to content

Commit

Permalink
[TEST] Add to_dict() test coverage for cheques models
Browse files Browse the repository at this point in the history
Added serialization test cases for data model classes:

- Add to_dict() test for Cheque
- Add to_dict() test for ChequeDetalle

Test coverage for cheques.py is now at 95%
  • Loading branch information
PPeitsch committed Dec 21, 2024
1 parent c8f417a commit 4e58e5f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/unit/models/test_cheques.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ def test_cheque_detalle_from_dict(self) -> None:
}
assert detalle == ChequeDetalle.from_dict(data)

def test_cheque_detalle_to_dict(self) -> None:
"""Test conversion of ChequeDetalle to dictionary."""
detalle = ChequeDetalle(sucursal=524, numero_cuenta=5240055962, causal="Test")
result = detalle.to_dict()

assert result["sucursal"] == 524
assert result["numeroCuenta"] == 5240055962
assert result["causal"] == "Test"


class TestCheque:
"""Test suite for Cheque model."""
Expand Down Expand Up @@ -129,6 +138,19 @@ def test_cheque_with_no_detalles(self) -> None:

assert len(cheque.detalles) == 0

def test_cheque_to_dict(self, sample_cheque_data: Dict[str, Any]) -> None:
"""Test conversion of Cheque to dictionary."""
cheque = Cheque.from_dict(sample_cheque_data)
result = cheque.to_dict()

assert result["numeroCheque"] == 20377516
assert result["denunciado"] is True
assert result["fechaProcesamiento"] == "2024-03-05"
assert result["denominacionEntidad"] == "BANCO DE LA NACION ARGENTINA"
assert isinstance(result["detalles"], list)
assert len(result["detalles"]) == 1
assert result["detalles"][0]["sucursal"] == 524


class TestResponses:
"""Test suite for API response models."""
Expand Down

0 comments on commit 4e58e5f

Please sign in to comment.