"""Test Account Tax Info History logic.""" from unittest.mock import patch from abacus_account.logic import account_tax_info_history as logic from tests.utils.factories import ( AccountFactory, AccountTaxInfoFactory, AccountTaxInfoHistoryFactory ) @patch('abacus_account.logic.account_tax_info_history.models') def test_get_account_tax_info_history(mock_model): """Test to create an account_tax_info_history for a given account_tax_info.""" account = AccountFactory.create() account_tax_info = AccountTaxInfoFactory.create(account=account) account_tax_info_history = AccountTaxInfoHistoryFactory.create( account=account, account_tax_info=account_tax_info ) mock_model.Account.get_by_id_or_error.return_value = account res = logic.get_account_tax_info_history(account.account_id) assert res.status == 200 message = res.message assert len(message) == 1 assert message[0]['account_tax_info_id'] == \ account_tax_info_history.account_tax_info_id