"""Payment group functional tests.""" from tests.utils.factories import ReferencePayoneerProgramFactory def test_get_payment_group_eligible_accounts( fixture_client, account_payment_eligible_via_closing_balance ): """Test get_payment_group_eligible_accounts endpoint.""" ReferencePayoneerProgramFactory.reset_sequence() res = fixture_client.get('/payment-group/123/eligible-accounts') assert res.status_code == 200 assert res.json == [ { 'account_id': 1, 'account_name': 'Account 1', 'contracts': [111], 'country_of_tax_residence': 'USA', 'currency_code': 'GBP', 'payment_minimum': '35.00', 'payment_schedule': '30_days_after_month_end', 'payoneer_program_id': 1, 'payment_entity_id': 5 } ] def test_get_payment_group_eligible_accounts_with_account_ids( fixture_client, account_payment_eligible_via_closing_balance_with_account_ids ): """Test get_payment_group_eligible_accounts with account_ids filter.""" ReferencePayoneerProgramFactory.reset_sequence() res = fixture_client.get('/payment-group/124/eligible-accounts') assert res.status_code == 200 assert res.json == [ { 'account_id': 1001, 'account_name': 'Account 1001', 'contracts': [1001], 'country_of_tax_residence': 'USA', 'currency_code': 'GBP', 'payment_minimum': '35.00', 'payment_schedule': '30_days_after_month_end', 'payoneer_program_id': 2, 'payment_entity_id': 5 }, { 'account_id': 1002, 'account_name': 'Account 1002', 'contracts': [1002], 'country_of_tax_residence': 'USA', 'currency_code': 'GBP', 'payment_minimum': '35.00', 'payment_schedule': '30_days_after_month_end', 'payoneer_program_id': 3, 'payment_entity_id': 5 }, { 'account_id': 1003, 'account_name': 'Account 1003', 'contracts': [1003], 'country_of_tax_residence': 'USA', 'currency_code': 'GBP', 'payment_minimum': '35.00', 'payment_schedule': '30_days_after_month_end', 'payoneer_program_id': 4, 'payment_entity_id': 5 } ]