"""Test Account Tax Info History schemas.""" from abacus_common_logic.utils.dates import safe_format_date import pytest from abacus_account.schemas.account_tax_info_history import AccountTaxInfoHistorySchema from tests.utils.factories import AccountTaxInfoHistoryFactory @pytest.mark.parametrize( 'country_of_tax_residence', ('USA', None) ) def test_account_tax_info_history_schema(country_of_tax_residence): """Test account_tax_info_history serialization.""" history = AccountTaxInfoHistoryFactory.create( country_of_tax_residence=country_of_tax_residence ) res = AccountTaxInfoHistorySchema().dump(history) assert res['account_tax_info_history_id'] == history.account_tax_info_history_id assert res['account_id'] == history.account_id assert res['country_of_tax_residence'] == history.country_of_tax_residence assert res['is_sba_signed'] == history.is_sba_signed assert res['is_vat_exempt'] == history.is_vat_exempt assert res['is_tax_treaty_claimed'] == history.is_tax_treaty_claimed assert res['tax_employment_type'] == history.tax_employment_type assert res[ 'certificate_of_residence_expiration_date' ] == history.certificate_of_residence_expiration_date assert res['is_wht_applicable'] == history.is_wht_applicable assert res[ 'is_resident_of_spanish_islands' ] == history.is_resident_of_spanish_islands assert res['wht_rate_override'] == history.wht_rate_override assert res['created_at'] == safe_format_date(history.created_at) assert res['last_modified'] == safe_format_date(history.last_modified)