"""Tests for statement_reserves handlers.""" from unittest.mock import patch @patch('moneyhub.handlers.statement_reserves.logic') def test_get_statement_reserves_by_account_id( mock_logic, fixture_client ): """Test to get reserves info per statement period for a specified account.""" account_id = 1 contract_id = 123 statement_period_id = 285 expected_response = { 'ledger_reserve_release_total': 1000.00, 'ledger_reserve_taken_total': -100.00, 'ledger_reserve_total': 900.00 } mock_logic.get_statement_reserves.return_value = expected_response res = fixture_client.get( f'/statement-reserves/account/{account_id}/statement-period/{statement_period_id}?contract_id={contract_id}') # noqa: E501 assert res.status_code == 200 assert res.json() == expected_response mock_logic.get_statement_reserves.assert_called_once_with( account_id, contract_id, statement_period_id)