"""Functional tests for ReferenceTaxWithholding.""" from decimal import Decimal from tests.utils.factories import ReferenceTaxWithholdingFactory def test_get_reference_tax_withholding(fixture_client): """Test to get reference tax withholding rates.""" ReferenceTaxWithholdingFactory.create( country_of_tax_residence='ARG', tax_rate=Decimal('5.00'), is_resource_provisioned=True, ) ReferenceTaxWithholdingFactory.create( country_of_tax_residence='BEL', tax_rate=Decimal('0.00'), is_resource_provisioned=None, ) res = fixture_client.get('/reference-tax-withholding') assert res.status_code == 200 assert res.json == { 'items': [ { 'reference_tax_withholding_id': 1, 'country_of_withholding': 'GBR', 'country_of_tax_residence': 'ARG', 'tax_rate': '5.00', 'is_resource_provisioned': True, }, { 'reference_tax_withholding_id': 2, 'country_of_withholding': 'GBR', 'country_of_tax_residence': 'BEL', 'tax_rate': '0.00', 'is_resource_provisioned': None, }, ], 'total_count': 2, } res = fixture_client.get( '/reference-tax-withholding' '?country_of_withholding=GBR&country_of_tax_residence=ARG' ) assert res.status_code == 200 assert res.json == { 'items': [ { 'reference_tax_withholding_id': 1, 'country_of_withholding': 'GBR', 'country_of_tax_residence': 'ARG', 'tax_rate': '5.00', 'is_resource_provisioned': True, }, ], 'total_count': 1, }